crewAIInc/crewAI · error · SystemExit

Project build failed. Please ensure that the command `uv bui

Error message

Project build failed. Please ensure that the command `uv build --sdist` completes successfully.

What it means

Printed with SystemExit(1) by ToolCommand.publish() when, after running `uv build --sdist` in a temp build dir, no *.tar.gz file is found in the output directory. It means the sdist build produced no artifact — typically because the build itself failed or the project's build configuration (pyproject.toml) is broken, invalid, or the package would be empty.

Source

Thrown at lib/cli/src/crewai_cli/tools/main.py:178

            pass

        with tempfile.TemporaryDirectory() as temp_build_dir:
            subprocess.run(  # noqa: S603
                ["uv", "build", "--sdist", "--out-dir", temp_build_dir],  # noqa: S607
                check=True,
                capture_output=False,
                env=build_env,
            )

            tarball_filename = next(
                (f for f in os.listdir(temp_build_dir) if f.endswith(".tar.gz")), None
            )
            if not tarball_filename:
                console.print(
                    "Project build failed. Please ensure that the command `uv build --sdist` completes successfully.",
                    style="bold red",
                )
                raise SystemExit(1)

            tarball_path = os.path.join(temp_build_dir, tarball_filename)
            with open(tarball_path, "rb") as file:
                tarball_contents = file.read()

            encoded_tarball = base64.b64encode(tarball_contents).decode("utf-8")

        console.print("[bold blue]Publishing tool to repository...[/bold blue]")
        publish_response = self.plus_api_client.publish_tool(
            handle=project_name,
            is_public=is_public,
            version=project_version,
            description=project_description,
            encoded_file=f"data:application/x-gzip;base64,{encoded_tarball}",
            available_exports=available_exports,
            tools_metadata=tools_metadata,
        )

View on GitHub (pinned to 754d7323be)

Solutions

  1. Reproduce the build directly to see the real error: `uv build --sdist` in the project root.
  2. Fix pyproject.toml: valid name, version, [build-system] with hatchling, and existing files referenced in metadata (readme, license).
  3. If the project was not scaffolded as a tool, regenerate with `crewai tool create <handle>` and port your code in.
  4. Upgrade uv (`pip install -U uv` / `uv self update`) so modern sdist targets are supported.

Example fix

# before (pyproject.toml missing build backend)
[project]
name = "my-tool"
version = "0.1.0"

# after
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "my-tool"
version = "0.1.0"
readme = "README.md"
Defensive patterns

Strategy: validation

Validate before calling

import subprocess, pathlib
def sdist_builds(project_dir: str) -> bool:
    r = subprocess.run(["uv", "build", "--sdist"], cwd=project_dir,
                       capture_output=True, text=True)
    if r.returncode != 0:
        print(r.stderr)
        return False
    return any(p.suffix == ".gz" for p in pathlib.Path(project_dir, "dist").glob("*.tar.gz"))

Prevention

When it happens

Trigger: Running `crewai tool publish` on a project whose pyproject.toml is malformed, has no [build-system]/hatchling config, excludes all files from the sdist, lacks a README referenced in metadata, or where `uv build --sdist` fails on version/spec errors (the output is streamed with capture_output=False so the uv errors appear above this message).

Common situations: Tool project scaffolded manually instead of via `crewai tool create`; pyproject.toml referencing a missing readme/license file; name/version fields missing or not PEP 508 compliant; uv not present or an old uv version that fails silently.

Related errors


AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15). Data as JSON: /api/errors/2f1fc319f3666967. Report an issue: GitHub.