{"record":{"id":"7a31043cd6efbb52","repo":"crewAIInc/crewAI","slug":"project-name-name-would-generate-class-name-7a3104","errorCode":null,"errorMessage":"Project name '{name}' would generate class name '{class_name}' which is a reserved Python keyword","messagePattern":"Project name '(.+?)' would generate class name '(.+?)' which is a reserved Python keyword","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/cli/src/crewai_cli/create_crew.py","lineNumber":115,"sourceCode":"    if not class_name:\n        raise ValueError(\n            f\"Project name '{name}' contains no valid characters for a Python class name\"\n        )\n\n    if class_name[0].isdigit():\n        raise ValueError(\n            f\"Project name '{name}' would generate class name '{class_name}' which cannot start with a digit\"\n        )\n\n    original_name_clean = re.sub(\n        r\"[^a-zA-Z0-9_]\", \"\", name.replace(\"_\", \"\").replace(\"-\", \"\").lower()\n    )\n    if (\n        keyword.iskeyword(original_name_clean)\n        or keyword.iskeyword(class_name)\n        or class_name in (\"True\", \"False\", \"None\")\n    ):\n        raise ValueError(\n            f\"Project name '{name}' would generate class name '{class_name}' which is a reserved Python keyword\"\n        )\n\n    if not class_name.isidentifier():\n        raise ValueError(\n            f\"Project name '{name}' would generate invalid Python class name '{class_name}'\"\n        )\n\n    if parent_folder:\n        folder_path = Path(parent_folder) / folder_name\n    else:\n        folder_path = Path(folder_name)\n\n    if folder_path.exists():\n        if is_dmn_mode_enabled():\n            raise click.ClickException(f\"Folder {folder_name} already exists.\")\n        if not click.confirm(\n            f\"Folder {folder_name} already exists. Do you want to override it?\"","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/cli/src/crewai_cli/create_crew.py#L97-L133","documentation":"Raised by ContextualRerankTool._run when a metadata list is supplied whose length differs from the documents list. The rerank API expects metadata[i] to annotate documents[i], so the tool validates len(metadata) == len(documents) before building the payload and raises ValueError on mismatch.","triggerScenarios":"Calling _run(documents=[d1, d2, d3], metadata=[m1, m2]) — e.g. metadata collected only for documents that passed a filter, or documents appended after metadata was built.","commonSituations":"Chunking pipelines where document chunks are regenerated but cached metadata is reused, filtering one list but not the other, or off-by-one when pairing sources to chunks.","solutions":["Build metadata and documents in one pass so they stay aligned: pairs = [(doc, meta) for ...]; docs, metas = zip(*pairs).","If metadata is optional, drop it entirely instead of passing a partial list.","Add an assert len(metadata) == len(documents) right where the two lists are assembled."],"exampleFix":"# before\nresult = tool._run(query=q, documents=docs, metadata=metas)  # lengths differ -> ValueError\n# after\nassert len(docs) == len(metas), f'{len(docs)} docs vs {len(metas)} metadata'\nresult = tool._run(query=q, documents=docs, metadata=metas)","handlingStrategy":"validation","validationCode":"if metadata is not None:\n    assert len(metadata) == len(documents), (\n        f\"{len(documents)} documents vs {len(metadata)} metadata entries\"\n    )\nresult = tool._run(query=query, documents=documents, metadata=metadata)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate documents and metadata in a single loop so indices stay aligned.","When filtering chunks, filter the metadata list with the same predicate in the same pass.","Treat metadata as all-or-nothing — never pass a partial list."],"tags":["contextualai","validation","rerank","data-alignment"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}