An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
Hello @Cristian Razvan
Thank you for providing the detailed error information, including the exception stack trace, Operation ID, APIM Request ID, and the behavior you observed. I understand how frustrating it is for a document analysis request to run for nearly two hours and ultimately fail with an InternalServerError, especially when the document is well within the documented service limits.
Based on the information you've shared and the available documentation, here's what we can infer.
Your request is initially accepted successfully (HTTP 200 OK), which indicates that the Document Intelligence service accepted the analysis request. However, during processing, the operation transitions to a failed state with:
{
"code": "InternalServerError",
"message": "An unexpected error occurred."
}
An InternalServerError generally indicates an unexpected service-side failure during processing rather than an issue with the client request itself. When available, additional information may be provided in the error.details or innererror fields, although in your case the service only returned the generic error.
Regarding the subsequent REST call returning:
{
"error": {
"code": "NotFound",
"innererror": {
"code": "OperationNotFound"
}
}
}
this is also consistent with the documented behavior. An OperationNotFound response can occur when:
- the operation identifier is invalid,
- the operation has expired, or
- the failed long-running operation is no longer available for retrieval.
Therefore, it is expected that after the operation fails, the same operation ID may no longer return status information.
About the document size
Although your document contains 360 pages, which is well below the documented maximum supported page limit (up to 2,000 pages for supported models), the maximum supported page count does not guarantee that every large document will complete successfully.
Processing time and success can also depend on factors such as:
- document complexity
- image quality and resolution
- scanned versus digitally generated PDFs
- tables and complex layouts
- embedded images or objects
- overall service load
A document within the supported limits can still encounter transient processing failures.
Would splitting the document help?
Based on the troubleshooting guidance in the documentation, yes.
Although batching isn't a documented requirement, for large or complex documents it is considered a best practice to split them into smaller batches (for example, 100–200 pages per request) before analysis.
Given the symptoms you've observed:
- approximately two-hour processing time,
- eventual InternalServerError, and
- inability to retrieve the completed operation,
processing the document in smaller batches can improve resiliency, reduce retry scope, and minimize the impact of transient service-side failures.
If your request uses a Blob Storage URL (SAS URI) rather than uploading the document directly, it's also worth verifying the storage configuration.
The documentation recommends checking:
- the SAS token is still valid and has not expired,
- the storage account firewall or networking configuration allows access,
- if using Managed Identity, the Document Intelligence resource has the appropriate Storage Blob Data Reader permissions.
While storage-related issues often return client-side errors such as 400 Bad Request, they are still worth validating if the service is retrieving the document from storage.
Since this is an unexpected server-side failure, we also recommend checking:
- Azure Service Health
- Azure Resource Health
- Azure Monitor metrics
to determine whether there were any service incidents or regional capacity issues during the processing timeframe.
About billing
You also asked whether the pages will be billed even though the operation failed.
At this time, the available documentation does not explicitly specify whether pages processed during a failed InternalServerError operation are billable. Therefore, we cannot conclusively confirm the billing behavior based solely on the public documentation.
If you'd like Microsoft to verify whether billing occurred for this specific request, we recommend opening a support request so the backend team can review the processing logs and billing records associated with the operation.
Please refer this
Error guide v4.0, v3.1, v3.0 (Document Intelligence unified error handling; meaning of InternalServerError) https://learn.microsoft.com/azure/ai-services/document-intelligence/how-to-guides/resolve-errors?view=doc-intel-4.0.0
Please do let me know if you have further queries.
Thank you!