crewAIInc/crewAI · error · ValueError
Project name '{name}' would generate folder name '{folder_na
Error message
Project name '{name}' would generate folder name '{folder_name}' which is a reserved Python keyword What it means
Printed by PlusAPIMixin.__init__ in crewai-cli when constructing the Plus API client fails — most commonly because get_auth_token() finds no stored CrewAI+ credentials. The CLI then raises AuthenticationRequiredError (a SystemExit subclass) aborting the command: any Plus/Enterprise CLI command (deploy, etc.) requires prior login.
Source
Thrown at lib/cli/src/crewai_cli/create_crew.py:76
folder_name = re.sub(r"[^a-zA-Z0-9_]", "", folder_name)
if re.match(r"^[^a-zA-Z0-9_-]+", name):
raise ValueError(
f"Project name '{name}' contains no valid characters for a Python module name"
)
if not folder_name:
raise ValueError(
f"Project name '{name}' contains no valid characters for a Python module name"
)
if folder_name[0].isdigit():
raise ValueError(
f"Project name '{name}' would generate folder name '{folder_name}' which cannot start with a digit (invalid Python module name)"
)
if keyword.iskeyword(folder_name):
raise ValueError(
f"Project name '{name}' would generate folder name '{folder_name}' which is a reserved Python keyword"
)
if not folder_name.isidentifier():
raise ValueError(
f"Project name '{name}' would generate invalid Python module name '{folder_name}'"
)
reserved_names = get_reserved_script_names()
if folder_name in reserved_names:
raise ValueError(
f"Project name '{name}' would generate folder name '{folder_name}' which is reserved. "
f"Reserved names are: {', '.join(sorted(reserved_names))}. "
"Please choose a different name."
)
class_name = name.replace("_", " ").replace("-", " ").title().replace(" ", "")
View on GitHub (pinned to 754d7323be)
Solutions
- Run 'crewai login' and complete the browser sign-in flow, then retry the command
- In CI/automation, provision the token non-interactively the way your CrewAI+ setup documents (exported auth token available to the CLI) before invoking Plus commands
- If login was already done, check the token storage location is present and readable for the same user/container that runs the CLI
- Catch AuthenticationRequiredError in wrappers/scripts to exit with a clear message instead of a traceback, since it subclasses SystemExit
Example fix
# before $ crewai deploy create ... # never logged in on this machine # after $ crewai login # complete sign-in first $ crewai deploy create ...
Defensive patterns
Strategy: validation
Validate before calling
import os
from pathlib import Path
def plus_cli_ready() -> bool:
"""Cheap preflight: is a crewai auth token present for this user?"""
return bool(os.environ.get("CREWAI_API_KEY")) or Path.home().joinpath(".crewai", "auth_token.json").exists() Try / catch
from crewai_cli.command import AuthenticationRequiredError
try:
run_crew_plus_command()
except AuthenticationRequiredError:
# subclasses SystemExit; catch it to convert into a friendly CI failure
print('Run "crewai login" or provision a token before this job')
sys.exit(2) Prevention
- Run 'crewai login' once as part of workstation/CI setup before any crewai deploy/plus command
- In automation, provision the auth token in the pipeline environment rather than assuming an interactive login
- Treat AuthenticationRequiredError (SystemExit subclass) as a setup failure, not a code bug
- Re-run login after rotating or revoking CrewAI+ credentials
When it happens
Trigger: Running crewai CLI commands that instantiate PlusAPIMixin (e.g. crewai deploy ... or crewai plus ...) before ever running 'crewai login', or after the stored token file was removed/corrupted. The broad `except Exception` also catches a missing/expired token and any PlusAPI construction failure (lib/cli/src/crewai_cli/command.py:38-48).
Common situations: Fresh machine or container with no prior login; CI pipeline missing the auth-token provisioning step; token file deleted by a cleanup script or Docker layer; corrupted token JSON.
Related errors
- Project name '{name}' would generate invalid Python module n
- Error. A valid pyproject.toml file is required. Check that a
- Error: {e}
- Project name cannot be empty or contain only whitespace
- Project name '{name}' contains no valid characters for a Pyt
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/c28f965ede326957.
Report an issue: GitHub.