Skip to content
← Back to activity

Immutable solution version

TrainingContentMissing error when building a custom document classifier | InvalidContentSourceFormat after adding ocr re

Version 2Sign in to save

Complete solution

Shows how to fix trainingContentMissing error when building a custom document classifier | InvalidContentSourceFormat after adding ocr re. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

For "TrainingContentMissing": what was reported: Issue Azure/azure-sdk-for-python#34370 (closed, 8 comments): - Package Name: azure.ai.formrecognizer - Package Version: 3.3.2 - Operating System: Windows 10 - Python Version: 3.10.13 Describe the bug When training a custom document classifier, there is a TrainingContentMissing error even tough the container\sas\url works.

TrainingContentMissing

Steps

  1. What was reported:

Issue Azure/azure-sdk-for-python#34370 (closed, 8 comments): - Package Name: azure.ai.formrecognizer - Package Version: 3.3.2 - Operating System: Windows 10 - Python Version: 3.10.13 Describe the bug When training a custom document classifier, there is a TrainingContentMissing error even tough the container_sas_url works. The code is based on this sample. I found a similar [issue](https://learn.microsoft.com/en-us/answers/questions/1300120/azure-form-recog

  1. What works:

If the custom document classifier build fails with TrainingContentMissing / InvalidContentSourceFormat on the OCR/re layout results, a working workaround is to bypass the parsed response and use the raw HTTP callback instead. Create the DocumentAnalysisClient, then pass a cls callback that captures raw_response.http_response and returns response.json() bytes. You get the full analysis payload without the SDK tripping over the content format.

When to use

You are seeing this: What was reported: Issue Azure/azure-sdk-for-python#34370 (closed, 8 comments): - Package Name: azure.ai.formrecognizer - Package Version: 3.3.2 - Operating System: Windows 10 - Python Version: 3.10.13 Describe the bug When training a custom document... Use this skill when you run into "TrainingContentMissing error when building a custom document classifier | InvalidContentSourceFormat after adding ocr re".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: 3.3.2, 3.10.13. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Sources

  • https://github.com/Azure/azure-sdk-for-python/blob/azure-ai-formrecognizer3.3.2/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2andlater/samplebuild_classifier.py
  • https://learn.microsoft.com/en-us/answers/questions/1300120/azure-form-recog

Evidence

In the GitHub issue, the reporter asked: TrainingContentMissing error when building a custom document classifier | InvalidContentSourceFormat after adding ocr re. The working answer that came out of the thread: If the custom document classifier build fails with TrainingContentMissing / InvalidContentSourceFormat on the OCR/re layout results, a working workaround is to bypass the parsed response and use the raw HTTP callback instead. Create the DocumentAnalysisClient, then pass a cls callback that captures rawresponse.httpresponse and returns response.json() bytes. You get the full analysis payload without the SDK tripping over the content format. Source: https://github.com/Azure/azure-sdk-for-python/issues/34370

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_ik5rpFG-TJ777Sm10Dmo7w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">TrainingContentMissing error when building a custom document classifier | InvalidContentSourceFormat after adding ocr re <span>— Vectle</span></a>