{"record":{"id":"7c8b5caa469b6f84","repo":"crewAIInc/crewAI","slug":"no-json-crew-definition-configured-in-tool-crewai","errorCode":null,"errorMessage":"No JSON crew definition configured in [tool.crewai].definition","messagePattern":"No JSON crew definition configured in \\[tool\\.crewai\\]\\.definition","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"lib/cli/src/crewai_cli/run_crew.py","lineNumber":327,"sourceCode":"    crew_path: str | Path | None = None,\n    inputs: str | None = None,\n) -> Any:\n    \"\"\"Load and run a JSON-defined crew.\"\"\"\n    from dotenv import load_dotenv\n\n    env_file = Path.cwd() / \".env\"\n    if env_file.exists():\n        load_dotenv(env_file, override=True)\n\n    # JSON crews run in-process, so export the trained-agents file directly\n    # instead of forwarding it to a subprocess like classic crews do.\n    if trained_agents_file:\n        os.environ[CREWAI_TRAINED_AGENTS_FILE_ENV] = trained_agents_file\n\n    if crew_path is None:\n        crew_path = configured_project_json_crew()\n    if crew_path is None:\n        raise FileNotFoundError(\n            \"No JSON crew definition configured in [tool.crewai].definition\"\n        )\n    crew_path = Path(crew_path)\n\n    provided = parse_inputs_json(inputs)\n\n    if is_dmn_mode_enabled():\n        return _run_json_crew_without_tui(crew_path, provided)\n\n    crew_run_app_cls, crew, default_inputs, task_names, agent_names = (\n        _load_json_crew_for_tui(crew_path)\n    )\n    runtime_inputs = _resolve_crew_inputs(\n        crew, default_inputs, provided, interactive=is_interactive()\n    )\n\n    app = crew_run_app_cls(\n        crew_name=crew.name or \"Crew\",","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/cli/src/crewai_cli/run_crew.py#L309-L345","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\n# pyproject.toml has no [tool.crewai] table\n$ crewai run\n# FileNotFoundError: No JSON crew definition configured in [tool.crewai].definition\n\n# after\n# pyproject.toml\n[tool.crewai]\ndefinition = \"crew.json\"","handlingStrategy":"validation","validationCode":"from pathlib import Path\nimport tomllib\n\npp = Path(\"pyproject.toml\")\nassert pp.is_file(), \"run from project root\"\ndata = tomllib.loads(pp.read_text())\ndefinition = data.get(\"tool\", {}).get(\"crewai\", {}).get(\"definition\")\nif not definition or not (Path.cwd() / definition).is_file():\n    raise SystemExit(\"[tool.crewai].definition missing or points at a nonexistent file\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["configuration","pyproject","json-crew","file-not-found","cli"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}