{"record":{"id":"c519da20357c7094","repo":"crewAIInc/crewAI","slug":"tool-crewai-definition-must-point-to-a-regular-f","errorCode":null,"errorMessage":"[tool.crewai] definition must point to a regular file; got {definition!r}.","messagePattern":"\\[tool\\.crewai\\] definition must point to a regular file; got (.+?)\\.","errorType":"exception","errorClass":"ProjectDefinitionError","httpStatus":null,"severity":"error","filePath":"lib/crewai-core/src/crewai_core/project.py","lineNumber":144,"sourceCode":"    except OSError as exc:\n        raise ProjectDefinitionError(\n            f\"Invalid [tool.crewai] definition path {definition!r}: {exc}\"\n        ) from exc\n\n    if not resolved_candidate.is_relative_to(root):\n        raise ProjectDefinitionError(\n            \"[tool.crewai] definition must resolve inside the project root; \"\n            f\"got {definition!r}.\"\n        )\n\n    if not resolved_candidate.exists():\n        raise ProjectDefinitionError(\n            \"[tool.crewai] definition must point to an existing file; \"\n            f\"got {definition!r}.\"\n        )\n\n    if not resolved_candidate.is_file():\n        raise ProjectDefinitionError(\n            \"[tool.crewai] definition must point to a regular file; \"\n            f\"got {definition!r}.\"\n        )\n\n    return resolved_candidate\n\n\ndef _get_nested_value(data: dict[str, Any], keys: list[str]) -> Any:\n    return reduce(dict.__getitem__, keys, data)\n\n\ndef _get_project_attribute(\n    pyproject_path: str, keys: list[str], require: bool\n) -> Any | None:\n    \"\"\"Look up a dotted attribute path inside ``pyproject_path``.\n\n    The file must declare ``crewai`` in ``[project].dependencies`` for the\n    lookup to succeed (a guard against running these helpers outside a crewai","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-core/src/crewai_core/project.py#L126-L162","documentation":"Raised when the definition path exists and passes containment checks but is not a regular file (Path.is_file() is False). Typical culprits: the path points at a directory, a FIFO/socket/device, or (on some platforms) a dangling special entry. The loader needs a readable file, so anything else is rejected with the offending definition value.","triggerScenarios":"definition = \"src/crew\" where that is a package directory; definition pointing at a named pipe created by a test harness; a device file path accidentally stored in the TOML.","commonSituations":"Users point the definition at the crew package folder instead of its entry module; directory-vs-file confusion after restructuring a flat script into a package.","solutions":["Point definition at the actual entry file (e.g. src/crew/main.py), not the package directory.","Verify with Path(p).is_file() during setup to catch this before the library does.","If you renamed directories, update the TOML value to include the filename."],"exampleFix":"# before\n[tool.crewai]\ndefinition = \"src/crew\"\n\n# after\n[tool.crewai]\ndefinition = \"src/crew/main.py\"","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ndef points_at_file(definition: str, root: Path) -> bool:\n    p = root / definition\n    return p.is_file()","typeGuard":null,"tryCatchPattern":"except ProjectDefinitionError as e:\n    if \"regular file\" in str(e):\n        print(\"definition must name a file, not a directory or special file\")","preventionTips":["Convention: always end definition with an explicit filename (e.g. main.py).","Add a startup self-test that resolves and is_file()s the definition."],"tags":["configuration","filesystem","path-validation"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}