crewAIInc/crewAI · error · ValueError

Project name '{name}' produces invalid folder name '{folder_

Error message

Project name '{name}' produces invalid folder name '{folder_name}'

What it means

Raised by _check_scope_and_collection_exists when the scope exists but collection_name is not among its collections. It fires only after the scope check passed, so the scope is correct and only the collection name is wrong.

Source

Thrown at lib/cli/src/crewai_cli/create_json_crew.py:886

    skip_provider: bool = False,
) -> None:
    """Scaffold a new JSON-first crew project."""
    import keyword
    import shutil

    dmn_mode = is_dmn_mode_enabled()
    if not dmn_mode:
        enable_prompt_line_editing()

    name = name.rstrip("/")
    if not name.strip():
        raise ValueError("Project name cannot be empty")

    folder_name = name.replace(" ", "_").replace("-", "_").lower()
    folder_name = re.sub(r"[^a-zA-Z0-9_]", "", folder_name)

    if not folder_name or folder_name[0].isdigit():
        raise ValueError(
            f"Project name '{name}' produces invalid folder name '{folder_name}'"
        )

    if keyword.iskeyword(folder_name):
        raise ValueError(f"'{folder_name}' is a reserved Python keyword")

    folder_path = Path(folder_name)
    if folder_path.exists():
        if dmn_mode:
            raise click.ClickException(f"Folder {folder_name} already exists.")
        if not click.confirm(f"Folder {folder_name} already exists. Override?"):
            click.secho("Cancelled.", fg="yellow")
            sys.exit(0)
        shutil.rmtree(folder_path)

    click.echo()
    click.secho(f"  Creating crew: {name}", fg="green", bold=True)

View on GitHub (pinned to 754d7323be)

Solutions

  1. Create the collection: cbt collection create <bucket>.<scope>.<collection> or scope.collection_manager.create_collection(...).
  2. Or set collection_name to an existing collection ('_default' works in the default scope).
  3. Enumerate collections to verify: [c.name for s in bucket.collections().get_all_scopes() if s.name == scope for c in s.collections].

Example fix

# before
tool = CouchbaseFTSVectorSearchTool(bucket_name='travel', scope_name='_default', collection_name='hotels', index_name='idx')  # ValueError
# after
from couchbase.cluster import Cluster
# create collection once: cluster.bucket('travel').collections().create_collection('_default', 'hotels')
tool = CouchbaseFTSVectorSearchTool(bucket_name='travel', scope_name='_default', collection_name='hotels', index_name='idx')
Defensive patterns

Strategy: validation

Validate before calling

cols = {
    c.name
    for s in cluster.bucket(bucket_name).collections().get_all_scopes()
    if s.name == scope_name
    for c in s.collections
}
if collection_name not in cols:
    raise ValueError(f"collection '{collection_name}' not in scope '{scope_name}'; available: {sorted(cols)}")

Prevention

When it happens

Trigger: Initializing the tool with a collection that has not been created in the (existing) scope — e.g. collection_name='hotels' when only '_default' exists in that scope.

Common situations: Migration scripts that create the scope but not the collection, plural/singular naming mismatches ('hotel' vs 'hotels'), or environment-specific collection names.

Related errors


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