{"record":{"id":"4326b35f3b1e0e2e","repo":"crewAIInc/crewAI","slug":"project-name-is-required-to-create-a-deployment-pa","errorCode":null,"errorMessage":"project_name is required to create a deployment payload","messagePattern":"project_name is required to create a deployment payload","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/cli/src/crewai_cli/deploy/main.py","lineNumber":536,"sourceCode":"            input(f\"Press Enter to continue with {_env_summary(env_vars)}\")\n\n    def _create_payload(\n        self,\n        env_vars: dict[str, str],\n        remote_repo_url: str,\n    ) -> CreateCrewPayload:\n        \"\"\"\n        Create the payload for crew creation.\n\n        Args:\n            remote_repo_url (str): Remote repository URL.\n            env_vars (Dict[str, str]): Environment variables.\n\n        Returns:\n            Dict[str, Any]: The payload for crew creation.\n        \"\"\"\n        if not self.project_name:\n            raise ValueError(\"project_name is required to create a deployment payload\")\n        return {\n            \"deploy\": {\n                \"name\": self.project_name,\n                \"repo_clone_url\": remote_repo_url,\n                \"env\": env_vars,\n            }\n        }\n\n    def _display_creation_success(self, json_response: dict[str, Any]) -> None:\n        \"\"\"\n        Display success message after crew creation.\n\n        Args:\n            json_response (Dict[str, Any]): The response containing crew information.\n        \"\"\"\n        console.print(\"Deployment created successfully!\\n\", style=\"bold green\")\n        console.print(\n            f\"Name: {self.project_name} ({json_response['uuid']})\", style=\"bold green\"","sourceCodeStart":518,"sourceCodeEnd":554,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/cli/src/crewai_cli/deploy/main.py#L518-L554","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\npayload = deployment_cmd._create_crew_payload(remote_repo_url, env_vars)\n# after\nif not deployment_cmd.project_name:\n    raise SystemExit(\"Project name not detected; run from the crew project root\")\npayload = deployment_cmd._create_crew_payload(remote_repo_url, env_vars)","handlingStrategy":"validation","validationCode":"def ensure_project_name(name: str | None) -> str:\n    if not name:\n        raise SystemExit(\"Project name not detected; run from the crew project root\")\n    return name","typeGuard":null,"tryCatchPattern":"try:\n    payload = cmd._create_crew_payload(remote_repo_url, env_vars)\nexcept ValueError as e:\n    if \"project_name is required\" in str(e):\n        raise SystemExit(\"Fix or restore the project name in pyproject.toml\") from e\n    raise","preventionTips":["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"],"tags":["cli","deployment","validation","payload"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}