crewAIInc/crewAI · error · RuntimeError
Document parsing failed
Error message
Document parsing failed
What it means
Error "Document parsing failed" thrown in crewAIInc/crewAI.
Source
Thrown at lib/crewai-tools/src/crewai_tools/tools/contextualai_parse_tool/contextual_parse_tool.py:95
with open(file_path, "rb") as fp:
file = {"raw_file": fp}
result = requests.post(
url, headers=headers, data=config, files=file, timeout=30
)
response = json.loads(result.text)
job_id = response["job_id"]
# Monitor job status
status_url = f"{base_url}/parse/jobs/{job_id}/status"
while True:
result = requests.get(status_url, headers=headers, timeout=30)
parse_response = json.loads(result.text)["status"]
if parse_response == "completed":
break
if parse_response == "failed":
raise RuntimeError("Document parsing failed")
sleep(5)
results_url = f"{base_url}/parse/jobs/{job_id}/results"
result = requests.get(
results_url,
headers=headers,
params={"output_types": ",".join(output_types)},
timeout=30,
)
return json.dumps(json.loads(result.text), indent=2)
except Exception as e:
return f"Failed to parse document: {e!s}"
View on GitHub (pinned to 754d7323be)
Solutions
- Check that the document is a supported format (PDF, etc.) and not corrupted.
- Verify your Contextual AI API key and account limits.
When it happens
Trigger: Thrown at lib/crewai-tools/src/crewai_tools/tools/contextualai_parse_tool/contextual_parse_tool.py:95 when the library encounters an invalid state.
Common situations: Occurs when the Contextual AI parse API fails to parse the document. Check the document format is supported and the API credentials are valid.
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/a3621b30ddc9097d.
Report an issue: GitHub.