crewAIInc/crewAI · error · FileNotFoundError
No JSON crew definition configured in [tool.crewai].definiti
Error message
No JSON crew definition configured in [tool.crewai].definition
What it means
A FileNotFoundError raised when running a JSON crew with no explicit crew path: the `crew_path` argument was None and configured_project_json_crew() also returned None, meaning pyproject.toml has no `[tool.crewai].definition` entry pointing at a crew.json(c) file. Because it is raised (not caught) inside the CLI, it propagates as a traceback rather than a friendly message.
Source
Thrown at lib/cli/src/crewai_cli/run_crew.py:327
crew_path: str | Path | None = None,
inputs: str | None = None,
) -> Any:
"""Load and run a JSON-defined crew."""
from dotenv import load_dotenv
env_file = Path.cwd() / ".env"
if env_file.exists():
load_dotenv(env_file, override=True)
# JSON crews run in-process, so export the trained-agents file directly
# instead of forwarding it to a subprocess like classic crews do.
if trained_agents_file:
os.environ[CREWAI_TRAINED_AGENTS_FILE_ENV] = trained_agents_file
if crew_path is None:
crew_path = configured_project_json_crew()
if crew_path is None:
raise FileNotFoundError(
"No JSON crew definition configured in [tool.crewai].definition"
)
crew_path = Path(crew_path)
provided = parse_inputs_json(inputs)
if is_dmn_mode_enabled():
return _run_json_crew_without_tui(crew_path, provided)
crew_run_app_cls, crew, default_inputs, task_names, agent_names = (
_load_json_crew_for_tui(crew_path)
)
runtime_inputs = _resolve_crew_inputs(
crew, default_inputs, provided, interactive=is_interactive()
)
app = crew_run_app_cls(
crew_name=crew.name or "Crew",View on GitHub (pinned to 754d7323be)
Solutions
- Add the definition entry to pyproject.toml: `[[tool.crewai]]` with `definition = "crew.json"` (path to your JSON crew).
- Or pass the path explicitly if the command supports it, so discovery is not needed.
- Run the command from the project root where pyproject.toml lives.
- If you meant to run a classic Python crew, use the classic flow entry point instead of the JSON-crew path.
Example fix
# before # pyproject.toml has no [tool.crewai] table $ crewai run # FileNotFoundError: No JSON crew definition configured in [tool.crewai].definition # after # pyproject.toml [tool.crewai] definition = "crew.json"
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
import tomllib
pp = Path("pyproject.toml")
assert pp.is_file(), "run from project root"
data = tomllib.loads(pp.read_text())
definition = data.get("tool", {}).get("crewai", {}).get("definition")
if not definition or not (Path.cwd() / definition).is_file():
raise SystemExit("[tool.crewai].definition missing or points at a nonexistent file") Prevention
- Always run `crewai run` for JSON crews from the project root containing pyproject.toml.
- Add `[tool.crewai] definition = "crew.json"` at scaffold time and keep it in code review scope.
- Fail fast in CI with a tomllib check rather than discovering the missing table at runtime.
When it happens
Trigger: Invoking `crewai run` (JSON-crew path) in a directory whose pyproject.toml lacks `[[tool.crewai]] definition = "crew.json"`; running from the wrong working directory so pyproject.toml isn't found; a scaffolded project that uses classic Python crews (crew.py) being invoked on the JSON path.
Common situations: Running the CLI from a subdirectory instead of the project root; a pyproject.toml edited by hand that dropped the `[tool.crewai]` table; mixing up classic (crew.py) and declarative JSON crew workflows.
Related errors
- project_name is required to create a ZIP deployment
- An unexpected error occurred while running the JSON crew: {e
- Invalid --definition path: {definition} does not exist.
- Error: Unknown or readonly configuration key '{key}'
- No organisation set. Run `crewai org switch <org_id>` first,
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/7c8b5caa469b6f84.
Report an issue: GitHub.