Skip to content

[codex] Improve crew run missing script error#6306

Draft
aditya-vithaldas wants to merge 1 commit into
crewAIInc:mainfrom
aditya-vithaldas:codex/clear-run-script-error
Draft

[codex] Improve crew run missing script error#6306
aditya-vithaldas wants to merge 1 commit into
crewAIInc:mainfrom
aditya-vithaldas:codex/clear-run-script-error

Conversation

@aditya-vithaldas

Copy link
Copy Markdown

Summary

Closes #6305.

  • Validate that classic crew projects define the run_crew project script before invoking uv.
  • Validate that Python flow projects define the kickoff project script before invoking uv.
  • Preserve legacy projects that omit [tool.crewai] but still define the expected run_crew script.

Root Cause

crewai run treated any non-JSON, non-flow project as a classic crew project and called uv run run_crew without checking whether the current pyproject.toml actually exposed that script. Running from a parent repository or unrelated Python project therefore surfaced uv's raw spawn failure instead of actionable CrewAI guidance.

Validation

  • uv run pytest lib/cli/tests/test_run_crew.py
  • uv run pytest lib/crewai/tests/cli/test_run_crew.py
  • uv run ruff check lib/cli/src/crewai_cli/run_crew.py lib/cli/tests/test_run_crew.py
  • Smoke checked crewai run from the repo root via PYTHONPATH=lib/cli/src:lib/crewai-core/src uv run python -m crewai_cli.cli run and confirmed it now reports the missing project script with directory guidance.

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9464f355-f40b-4ab0-b7bf-9c252339a17b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@corridor-security corridor-security Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary: This PR adds validation that expected pyproject.toml scripts exist before invoking uv for crew and flow runs, reducing accidental execution attempts from unrelated directories. No exploitable security vulnerabilities were identified in the added code.

Risk: Low risk. The changes affect local CLI control flow and error handling, do not introduce new network-facing surfaces, authentication changes, sensitive data handling, or unsafe subprocess argument construction.

@aditya-vithaldas aditya-vithaldas force-pushed the codex/clear-run-script-error branch from dac0e16 to 3fabc55 Compare June 23, 2026 13:26

Copy link
Copy Markdown
Author

Updated after retesting the generated-project repro. The PR now also scans immediate child directories for a runnable CrewAI project and includes a concrete next step when the user is still in the parent folder, e.g.

Found a CrewAI project in `ai_agent_news`. Try:

  cd ai_agent_news
  crewai run

The generated ai_agent_news project itself exposes the expected run_crew console script; the failing case is running from the parent directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

crewai run shows raw uv spawn error when run outside a CrewAI project

1 participant