ResourceNotFoundError in Azure document intelligence SDK

Tran Minh 25 Reputation points
2024-09-24T09:21:02.0266667+00:00

I use Azure document intelligence to extract figures from pdf documents.

API : FormRecognizer

Pricing tier : Standard
```I used sample code from Ms doc

 `https://learn.microsoft.com/en-us/python/api/overview/azure/ai-documentintelligence-readme?view=azure-python-preview`

Until last week (2024 Sept 20) everything is okay, but today I've got this error.   
This error happend while the figures are extracting from pdf document.  
It occurs erratically and randomly between extractions.  
  
I don't know what was wrong or this is Azure system's error.
```python

---------------------------------------------------------------------------
ResourceNotFoundError                     Traceback (most recent call last)
Cell In[16], line 38
     34 for figure in result.figures:
     35     if figure['id']:
     36         #print(figure)
     37         #print("\n")
---> 38         response = document_intelligence_client.get_analyze_result_figure(
     39             model_id=result.model_id, 
     40             result_id=operation_id, 
     41             figure_id=figure['id']
     42         )
     43         #print(response)
     44         #print("\n")
     46         integer_part, decimal_part = str(figure['id']).split('.')

File /opt/miniconda3/lib/python3.9/site-packages/azure/core/tracing/decorator.py:78, in distributed_trace.<locals>.decorator.<locals>.wrapper_use_tracer(*args, **kwargs)
     76 span_impl_type = settings.tracing_implementation()
     77 if span_impl_type is None:
---> 78     return func(*args, **kwargs)
     80 # Merge span is parameter is set, but only if no explicit parent are passed
     81 if merge_span and not passed_in_parent:

File /opt/miniconda3/lib/python3.9/site-packages/azure/ai/documentintelligence/_operations/_operations.py:1470, in DocumentIntelligenceClientOperationsMixin.get_analyze_result_figure(self, model_id, result_id, figure_id, **kwargs)
   1468     except (StreamConsumedError, StreamClosedError):
   1469         pass
-> 1470 map_error(status_code=response.status_code, response=response, error_map=error_map)
   1471 error = _deserialize(_models.ErrorResponse, response.json())
   1472 raise HttpResponseError(response=response, model=error)

File /opt/miniconda3/lib/python3.9/site-packages/azure/core/exceptions.py:164, in map_error(status_code, response, error_map)
    162     return
    163 error = error_type(response=response)
--> 164 raise error

ResourceNotFoundError: (NotFound) Figures analyze result does not exist.
Code: NotFound
Message: Figures analyze result does not exist.
			
Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
2,112 questions
{count} vote

Accepted answer
  1. santoshkc 15,355 Reputation points Microsoft External Staff Moderator
    2024-09-25T18:22:39.6433333+00:00

    Hi @Tran Minh,

    I'm glad to hear that it works properly now. It sounds like the issue was indeed related to an intermittent problem on Azure's side, which can occasionally happen due to service updates or maintenance.

    Thanks for sharing the information, which might be beneficial to other community members reading this thread as solution. Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", so I'll reiterate your response to an answer in case you'd like to accept the answer. This will help other users who may have a similar query find the solution more easily.

    Query: ResourceNotFoundError in Azure document intelligence SDK.

    Solution: It works properly now, even I did not fix any lines of code. I think problem is about azure request handle.

    If you have any further questions or concerns, please don't hesitate to ask. We're always here to help.


    Do click Accept Answer and Yes for was this answer helpful.


1 additional answer

Sort by: Most helpful
  1. Tran Minh 25 Reputation points
    2024-09-25T07:47:37.42+00:00

    Hi @santoshkc
    Thank you so much, it works properly now, even I did not fix any lines of code. I think problem is about azure request hanlde.

    0 comments No comments

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.