apache/superset · error · ExtensionNameError
Package name '{name}' cannot start with a number
Error message
Package name '{name}' cannot start with a number What it means
Part of the Superset extensions CLI scaffolder validation. validate_python_package_name rejects names whose first character is a digit, because Python identifiers (and thus the generated package/module names) cannot start with a number. The rejected name is included in the ExtensionNameError message.
Source
Thrown at superset-extensions-cli/src/superset_extensions_cli/utils.py:195
return kebab_name.replace("-", "_")
def name_to_kebab_case(name: str) -> str:
"""Convert display name directly to kebab-case (e.g., 'Hello World' -> 'hello-world')."""
normalized = _normalize_for_identifiers(name)
return _normalized_to_kebab(normalized)
def validate_python_package_name(name: str) -> None:
"""
Validate Python package name (snake_case format).
Raises:
ExtensionNameError: If name is invalid
"""
# Check if it starts with a number (invalid for Python identifiers)
if name[0].isdigit():
raise ExtensionNameError(f"Package name '{name}' cannot start with a number")
# Check if the first part (before any underscore) is a Python keyword
if (first_part := name.split("_")[0]) in PYTHON_KEYWORDS:
raise ExtensionNameError(
f"Package name cannot start with Python keyword '{first_part}'"
)
# Check if it's a valid Python identifier
if not name.replace("_", "a").isalnum():
raise ExtensionNameError(f"'{name}' is not a valid Python package name")
def validate_npm_package_name(name: str) -> None:
"""
Validate npm package name (kebab-case format).
Raises:
ExtensionNameError: If name is invalidView on GitHub (pinned to f4587218dd)
Solutions
- Choose a name starting with a letter, e.g. 'view3d' instead of '3dview'.
- Prefix numeric-leading names with a letter word: 'auth-2fa'.
- Pre-validate names in any automation that calls the CLI.
Example fix
# before $ superset-extension new 2fa-auth # after $ superset-extension new auth-2fa
Defensive patterns
Strategy: validation
Validate before calling
def valid_python_package_prefix(name: str) -> bool:
return bool(name) and not name[0].isdigit() Try / catch
from superset_extensions_cli.utils import ExtensionNameError
try:
validate_python_package_name(name)
except ExtensionNameError as e:
print(f'Pick a different extension name: {e}')
sys.exit(2) Prevention
- Start extension names with a letter; lead with a word when the brand begins with a digit (auth-2fa, view3d).
- Pre-validate names in scripts before invoking the CLI.
When it happens
Trigger: Running the extensions CLI new/create command with an extension name like '2fa-auth' or '4xx' whose normalized snake_case package name starts with a digit.
Common situations: Product names that begin with a number ('3d-viewer'); names normalized from camelCase where the leading token is numeric; scripted scaffolding feeding arbitrary strings.
Related errors
- Package name cannot start with Python keyword '{first_part}'
- '{name}' is not a valid Python package name
- '{name}' is a reserved npm package name
- Publisher cannot be empty
- Publisher must start with a letter and contain only lowercas
AI-assisted analysis of apache/superset@f4587218dd (2026-08-14).
Data as JSON: /api/errors/96c64b3410d10a51.
Report an issue: GitHub.