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 cannot start with a digit (invalid Python module name)

What it means

Raised by validate_auth_against_agent_card (A2AClientHTTPError 401) as the fall-through when the card's first security requirement references a scheme the validator cannot map: the scheme_name is missing from security_schemes, or its type/scheme value is unrecognized by _SCHEME_AUTH_MAPPING and _HTTP_SCHEME_MAPPING. The validator cannot prove the provided auth satisfies the requirement, so it refuses.

Source

Thrown at lib/cli/src/crewai_cli/create_crew.py:71

    if not name.strip():
        raise ValueError("Project name cannot be empty or contain only whitespace")

    folder_name = name.replace(" ", "_").replace("-", "_").lower()
    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))}. "

View on GitHub (pinned to 754d7323be)

Solutions

  1. Check that every key in agent_card.security[0] exists in agent_card.security_schemes — fix the card if a name is misspelled
  2. Upgrade the client's crewai package to a version whose _SCHEME_AUTH_MAPPING/_HTTP_SCHEME_MAPPING cover the declared scheme type
  3. If the card offers multiple security options, pass an auth matching one of the mappable schemes so the validator returns early
  4. For custom scheme types, adjust the serving agent's AgentCard to use a standard scheme (apiKey, http/bearer, http/basic, oauth2) the client understands

Example fix

# before (card inconsistency)
security=[{'auth_key': {}}],  # 'auth_key' not present in security_schemes

# after
security=[{'apiKey': {}}],
security_schemes={'apiKey': APIKeySecurityScheme(name='apiKey', location=APIKeyLocation.header, header_name='X-API-Key')}
Defensive patterns

Strategy: validation

Validate before calling

def card_is_validatable(card) -> bool:
    """Every scheme named by security[0] must exist in security_schemes."""
    if not card.security or not card.security_schemes:
        return True
    named = card.security[0] if card.security else {}
    return all(name in card.security_schemes for name in named)

Try / catch

from crewai.a2a.auth.errors import A2AClientHTTPError
from crewai.a2a.auth.utils import validate_auth_against_agent_card

try:
    validate_auth_against_agent_card(card, auth)
except A2AClientHTTPError as e:
    if e.code == 401 and "Could not validate" in str(e):
        # unmapped/unknown scheme: upgrade client or pin the agent to a standard scheme
        raise UnsupportedCardScheme(str(e)) from e
    raise

Prevention

When it happens

Trigger: AgentCard declares a scheme type the client library version does not know (e.g. a newer spec scheme like OpenIdConnect variants or a custom HTTP scheme value like scheme='digest'), or security[0] references a scheme name that has no entry in security_schemes so the loop completes without returning (utils.py:171-191).

Common situations: Version skew: remote agent built with a newer CrewAI/a2a-sdk exposing scheme types the client cannot map; hand-crafted AgentCard with inconsistent security vs security_schemes keys; typo in the scheme key inside the first security requirement.

Related errors


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