crewAIInc/crewAI · error · FileNotFoundError
Document not found: {doc_path}
Error message
Document not found: {doc_path} What it means
Error "Document not found: {doc_path}" thrown in crewAIInc/crewAI.
Source
Thrown at lib/crewai-tools/src/crewai_tools/tools/contextualai_create_agent_tool/contextual_create_agent_tool.py:63
self,
agent_name: str,
agent_description: str,
datastore_name: str,
document_paths: list[str],
) -> str:
"""Create a complete RAG pipeline with documents."""
resolved_paths = [validate_file_path(doc_path) for doc_path in document_paths]
try:
import os
datastore = self.contextual_client.datastores.create(name=datastore_name)
datastore_id = datastore.id
# Upload documents
document_ids = []
for doc_path in resolved_paths:
if not os.path.exists(doc_path):
raise FileNotFoundError(f"Document not found: {doc_path}")
with open(doc_path, "rb") as f:
ingestion_result = (
self.contextual_client.datastores.documents.ingest(
datastore_id, file=f
)
)
document_ids.append(ingestion_result.id)
agent = self.contextual_client.agents.create(
name=agent_name,
description=agent_description,
datastore_ids=[datastore_id],
)
return f"Successfully created agent '{agent_name}' with ID: {agent.id} and datastore ID: {datastore_id}. Uploaded {len(document_ids)} documents."
except Exception as e:View on GitHub (pinned to 754d7323be)
Solutions
- Verify the document path exists and is readable.
- Use an absolute path or a path relative to the current working directory.
When it happens
Trigger: Thrown at lib/crewai-tools/src/crewai_tools/tools/contextualai_create_agent_tool/contextual_create_agent_tool.py:63 when the library encounters an invalid state.
Common situations: Occurs when the document path passed to the Contextual AI create-agent tool does not exist. Verify the path and that the file is accessible.
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/bc0946a59d5511b3.
Report an issue: GitHub.