InternalServerError during document processing on Document Intelligence Service

Paweł L 25 Reputation points
2025-07-01T16:10:06.6966667+00:00

During an attempt to read document data (via Postman) in the Document Intelligence service:

https://mydomain.cognitiveservices.azure.com/documentintelligence/documentModels/prebuilt-invoice/analyzeResults/xxxxxxxx-xxxxx-xxxxxxxxx-xxxxxx?api-version=2024-11-30
we receive the following error:

{
    "status": "failed",
    "createdDateTime": "2025-07-01T09:46:59Z",
    "lastUpdatedDateTime": "2025-07-01T09:46:59Z",
    "error": {
        "code": "InternalServerError",
        "message": "An unexpected error occurred.",
        "details": [
            {
                "code": "InternalServerError",
                "message": "An unexpected error occurred.",
                "target": "0"
            }
        ]
    }
}

What could be the cause of this error, and is it possible to perform a detailed verification of this specific case on the Azure side? We have the Log Analytics service enabled, and when reviewing the AzureDiagnostics logs, no errors are visible.

When we ask for other document we receive eigher proper result or "resource not found" if it is random resource number.

Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
2,135 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Pavankumar Purilla 8,665 Reputation points Microsoft External Staff Moderator
    2025-07-01T20:31:40.7666667+00:00

    Hi Paweł L,
    The error behavior you're observing receiving an InternalServerError for a specific document along with a 401 Unauthorized response when querying the result via Postman suggests that there may be multiple issues occurring in sequence. The InternalServerError typically occurs during the document processing phase when something unexpected fails in the backend, often due to malformed content, unsupported document structure, or internal limits being exceeded. Since other documents process correctly and this issue consistently occurs with a specific file, it likely points to a problem intrinsic to that file (e.g., corrupted PDF metadata, excessive size, or an edge case that triggers a failure in the prebuilt-invoice model).

    However, the 401 Unauthorized error you’re now encountering when trying to retrieve the results via Postman is a separate issue. This indicates that the request is being rejected due to an invalid subscription key or a mismatch between the endpoint region and the resource's actual deployment region. This could happen if the endpoint URL used in the GET request does not match the Azure region where the Document Intelligence resource is deployed (e.g., using westeurope instead of eastus). It’s also important to confirm that the same key used during submission is being used during retrieval, and that it is passed in the request header using Ocp-Apim-Subscription-Key.

    As a workaround, we recommend confirming the exact region and endpoint of your Document Intelligence resource in the Azure portal under "Keys and Endpoint" and ensuring your API requests both for submission and result retrieval—use that same regional endpoint and subscription key. For the document that triggered the internal server error, try converting or simplifying the file and reprocess it using either the same or a different model like prebuilt-document to verify whether the issue is model-specific.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.