crewAIInc/crewAI · error · ValueError
project_name is required to create a deployment payload
Error message
project_name is required to create a deployment payload
What it means
Thrown by DeploymentCommand when building the CreateCrewPayload if self.project_name is falsy. The creation payload's `deploy.name` field is the project name, so an empty name makes the payload invalid and the CLI refuses to send it. It is a fast-fail guard inside `_create_crew_payload`, raised before any network call.
Source
Thrown at lib/cli/src/crewai_cli/deploy/main.py:536
input(f"Press Enter to continue with {_env_summary(env_vars)}")
def _create_payload(
self,
env_vars: dict[str, str],
remote_repo_url: str,
) -> CreateCrewPayload:
"""
Create the payload for crew creation.
Args:
remote_repo_url (str): Remote repository URL.
env_vars (Dict[str, str]): Environment variables.
Returns:
Dict[str, Any]: The payload for crew creation.
"""
if not self.project_name:
raise ValueError("project_name is required to create a deployment payload")
return {
"deploy": {
"name": self.project_name,
"repo_clone_url": remote_repo_url,
"env": env_vars,
}
}
def _display_creation_success(self, json_response: dict[str, Any]) -> None:
"""
Display success message after crew creation.
Args:
json_response (Dict[str, Any]): The response containing crew information.
"""
console.print("Deployment created successfully!\n", style="bold green")
console.print(
f"Name: {self.project_name} ({json_response['uuid']})", style="bold green"View on GitHub (pinned to 754d7323be)
Solutions
- Run `crewai deploy create` from the project root containing a valid pyproject.toml with the project name
- Restore or fix the project name field in pyproject.toml if it was removed
- Supply the project name when constructing the deployment command/CrewAI object in scripts
Example fix
# before
payload = deployment_cmd._create_crew_payload(remote_repo_url, env_vars)
# after
if not deployment_cmd.project_name:
raise SystemExit("Project name not detected; run from the crew project root")
payload = deployment_cmd._create_crew_payload(remote_repo_url, env_vars) Defensive patterns
Strategy: validation
Validate before calling
def ensure_project_name(name: str | None) -> str:
if not name:
raise SystemExit("Project name not detected; run from the crew project root")
return name Try / catch
try:
payload = cmd._create_crew_payload(remote_repo_url, env_vars)
except ValueError as e:
if "project_name is required" in str(e):
raise SystemExit("Fix or restore the project name in pyproject.toml") from e
raise Prevention
- Scaffold projects with crewai create so name detection always succeeds
- Never strip the project section from pyproject.toml
- Pass explicit names when driving DeploymentCommand programmatically
When it happens
Trigger: Calling `crewai deploy create` (repo-based flow) from a directory where project name detection failed, or calling DeploymentCommand._create_crew_payload programmatically with project_name unset. Any create-crew payload build without a resolvable project name triggers it.
Common situations: Running deploy create outside a project scaffold (missing pyproject.toml or crewai project section), a corrupted/emptied pyproject.toml, or programmatic use of DeploymentCommand where the name was never supplied.
Related errors
- project_name is required to update a ZIP deployment
- {self.path} is not a Git repository.
- The number of iterations must be a positive integer.
- Git is not installed or not found in your PATH.
- Invalid --inputs JSON: {exc}
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/4326b35f3b1e0e2e.
Report an issue: GitHub.