[BUG] crewai tool create/install/login exit 0 when they fail

Open Beginner friendly
#9,763 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Kiko0301 is already working on this.

Since Nov 25, 2026.

  • #9767 by @Kiko0301 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli

Research direction

The six failing paths are listed by line number in lib/cli/src/crewai_cli/tools/main.py: create (lines 77 and 310), install (219, 224, 297) and login (255). Each bare raise SystemExit should become raise SystemExit(1), matching the existing publish failures in the same file. Reproduce by running crewai tool create demo twice and checking echo $?; done means every listed failure path returns a non-zero status.

Written by the indexing model from the issue text.

Description

Description

Several failure paths in lib/cli/src/crewai_cli/tools/main.py end with a bare raise SystemExit. SystemExit() carries code None, which the interpreter reports as exit status 0, so the commands print their error and report success to scripts and CI:

Line Command Failure
77 crewai tool create target folder already exists
219 crewai tool install API returned 404 (no such tool)
224 crewai tool install API returned any non-200 status
255 crewai tool login login endpoint returned non-200
297 crewai tool install uv add wrote to stderr
310 crewai tool create run from inside an existing project

The same file already uses raise SystemExit(1) for the failures in publish (and for _require_project_utils / _require_get_user_id), so these are omissions rather than a deliberate choice.

Steps to Reproduce

$ crewai tool create demo
Creating custom tool demo...
...
$ crewai tool create demo
Folder demo already exists.
$ echo $?
0
$ cd /path/to/any/crewai/project     # a directory with pyproject.toml
$ crewai tool create demo
Oops! It looks like you're inside a project.
You can't create a new tool while inside an existing project.
Tip: Navigate to a different directory and try again.
$ echo $?
0

crewai tool install <tool-that-does-not-exist> and a failed crewai tool login behave the same: message on stdout, exit status 0.

Expected Behavior

Every failure above should exit with a non-zero status (for example raise SystemExit(1)), so a script or CI job can tell a failed crewai tool command from a successful one.

AI assistance

I used an AI coding agent to investigate, reproduce, and prepare this report, and reviewed its results. Per CONTRIBUTING.md, please apply the llm-generated label; external contributors cannot add it with my current permissions.

Dominant language
Python
Stars
61.2k
Forks
9.2k
Avg merge
1d 12h
Merged PRs (30d)
228

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from crewAIInc/crewAI

All issues in crewAIInc/crewAI

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.