{"record":{"id":"86587f5a93c1e181","repo":"crewAIInc/crewAI","slug":"invalid-definition-path-definition-does-not-e","errorCode":null,"errorMessage":"Invalid --definition path: {definition} does not exist.","messagePattern":"Invalid --definition path: (.+?) does not exist\\.","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"lib/cli/src/crewai_cli/run_declarative_flow.py","lineNumber":434,"sourceCode":"        click.echo(\n            \"Running declarative flows requires the full crewai package.\",\n            err=True,\n        )\n        raise SystemExit(1) from exc\n\n    definition_path = Path(definition).expanduser()\n    try:\n        if not definition_path.is_file():\n            if definition_path.exists():\n                click.echo(\n                    f\"Invalid --definition path: {definition} is not a file.\",\n                    err=True,\n                )\n                raise SystemExit(1)\n            click.echo(\n                f\"Invalid --definition path: {definition} does not exist.\", err=True\n            )\n            raise SystemExit(1)\n    except OSError as exc:\n        click.echo(f\"Invalid --definition path: {definition} ({exc})\", err=True)\n        raise SystemExit(1) from exc\n\n    try:\n        return Flow.from_declaration(path=definition_path)\n    except (OSError, UnicodeError, ValueError, ValidationError) as exc:\n        click.echo(\n            f\"Unable to read --definition path {definition_path}: {exc}\",\n            err=True,\n        )\n        raise SystemExit(1) from exc\n\n\ndef configured_project_declarative_flow(\n    pyproject_data: dict[str, Any] | None = None,\n    project_root: Path | None = None,\n) -> Path | None:","sourceCodeStart":416,"sourceCodeEnd":452,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/cli/src/crewai_cli/run_declarative_flow.py#L416-L452","documentation":"Path validation in load_declarative_flow(): definition_path.is_file() is False and definition_path.exists() is also False — the --definition argument points at a path that does not exist on disk. Expansion with expanduser() happens first, so '~/...' paths are honored. The CLI prints the message to stderr and exits 1.","triggerScenarios":"Typo in the path; running the command from a different working directory so a relative path doesn't resolve; the definition file not yet created; a deleted/moved file; a configured pyproject path that no longer exists.","commonSituations":"Running `crewai flow ...` from a subdirectory instead of the project root; CI checkout missing the definition file because it's gitignored; renamed files.","solutions":["Check the file exists: `ls -la <path>` from the same directory you run the command in.","Use an absolute path or correct relative path (relative to the current working directory, not the project root).","If the file is gitignored/missing in CI, commit it or generate it in the pipeline.","Update the definition path in pyproject.toml if it is configured there."],"exampleFix":"# before\n$ crewai flow run --definition flows/flow.yml   # actual name: flow.yaml\n# Invalid --definition path: flows/flow.yml does not exist.\n\n# after\n$ crewai flow run --definition flows/flow.yaml","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\npath = Path(definition_arg).expanduser().resolve()\nif not path.exists():\n    raise SystemExit(f\"definition file not found: {path}\")","typeGuard":"from pathlib import Path\n\ndef definition_exists(p: str | Path) -> bool:\n    return Path(p).expanduser().resolve().exists()","tryCatchPattern":null,"preventionTips":["Run CLI commands from the project root or pass absolute definition paths in scripts.","Commit definition files (don't gitignore them) so CI checkouts always have them.","After renames, grep the repo and CI config for the old filename."],"tags":["validation","path","file-not-found","flow","cli"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}