crewAIInc/crewAI · error · ValueError

project_name is required to update a ZIP deployment

Error message

project_name is required to update a ZIP deployment

What it means

Raised by CrewAI CLI's deployment command when _update_crew_from_zip is called on a deployment whose project_name attribute is empty or None. The ZIP update flow needs a project directory name to build the archive via create_project_zip, so an empty name cannot proceed. It surfaces as an uncaught ValueError from `crewai deploy update` (ZIP mode).

Source

Thrown at lib/cli/src/crewai_cli/deploy/main.py:484

            self._confirm_zip_input(env_vars, confirm)
            console.print("Uploading project ZIP...", style="bold blue")
            return self.plus_api_client.create_crew_from_zip(
                zip_file_path,
                name=self.project_name,
                env=env_vars,
            )
        finally:
            zip_file_path.unlink(missing_ok=True)

    def _update_crew_from_zip(
        self,
        uuid: str,
        repository: git.Repository | None,
        env_vars: dict[str, str],
    ) -> Any:
        """Update an existing deployment by uploading a project ZIP archive."""
        if not self.project_name:
            raise ValueError("project_name is required to update a ZIP deployment")

        console.print("Preparing project ZIP...", style="bold blue")
        zip_file_path = create_project_zip(self.project_name, repository=repository)
        try:
            console.print("Uploading project ZIP...", style="bold blue")
            return self.plus_api_client.update_crew_from_zip(
                uuid,
                zip_file_path,
                env=env_vars,
            )
        finally:
            zip_file_path.unlink(missing_ok=True)

    def _confirm_input(
        self, env_vars: dict[str, str], remote_repo_url: str, confirm: bool
    ) -> None:
        """
        Confirm input parameters with the user.

View on GitHub (pinned to 754d7323be)

Solutions

  1. Verify you are in the project root that contains the pyproject.toml used at creation time and re-run `crewai deploy update <uuid> --zip`
  2. Check that pyproject.toml still exposes a valid project name; fix or restore it if the file was renamed/edited
  3. If invoking DeploymentCommand programmatically, pass the project name explicitly (e.g. via the constructor/CrewAI object) so self.project_name is set before calling update

Example fix

# before
crew.update_crew_from_zip(uuid=uuid, repository=repo, env_vars=env)
# after (ensure project name resolves first)
if not crew.project_name:
    raise SystemExit("Run this from the project root containing pyproject.toml")
crew.update_crew_from_zip(uuid=uuid, repository=repo, env_vars=env)
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
import tomllib

def project_name_resolves(root: str = ".") -> bool:
    py = Path(root) / "pyproject.toml"
    if not py.exists():
        return False
    data = tomllib.loads(py.read_text())
    return bool(data.get("project", {}).get("name") or data.get("tool", {}).get("poetry", {}).get("name"))

Try / catch

try:
    deployment.update_crew_from_zip(uuid=uuid, repository=repo, env_vars=env)
except ValueError as e:
    if "project_name is required" in str(e):
        raise SystemExit("Run from the crew project root (pyproject.toml required)") from e
    raise

Prevention

When it happens

Trigger: Running `crewai deploy update <uuid> --zip` (or the plus-api ZIP update path) from a directory where the CLI failed to detect a project name, or calling DeploymentCommand._update_crew_from_zip directly with project_name unset (e.g. the CrewAI object was constructed without a valid pyproject.toml/package name).

Common situations: Running the deploy command outside a crew project root (no pyproject.toml), a pyproject.toml missing the crewai project metadata, or a renamed/moved project directory so name auto-detection returns empty.

Related errors


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