{"record":{"id":"d71b9cd33d5b9cea","repo":"apache/superset","slug":"name-is-a-reserved-npm-package-name","errorCode":null,"errorMessage":"'{name}' is a reserved npm package name","messagePattern":"'(.+?)' is a reserved npm package name","errorType":"exception","errorClass":"ExtensionNameError","httpStatus":null,"severity":"error","filePath":"superset-extensions-cli/src/superset_extensions_cli/utils.py","lineNumber":216,"sourceCode":"    if (first_part := name.split(\"_\")[0]) in PYTHON_KEYWORDS:\n        raise ExtensionNameError(\n            f\"Package name cannot start with Python keyword '{first_part}'\"\n        )\n\n    # Check if it's a valid Python identifier\n    if not name.replace(\"_\", \"a\").isalnum():\n        raise ExtensionNameError(f\"'{name}' is not a valid Python package name\")\n\n\ndef validate_npm_package_name(name: str) -> None:\n    \"\"\"\n    Validate npm package name (kebab-case format).\n\n    Raises:\n        ExtensionNameError: If name is invalid\n    \"\"\"\n    if name.lower() in NPM_RESERVED:\n        raise ExtensionNameError(f\"'{name}' is a reserved npm package name\")\n\n\ndef validate_publisher(publisher: str) -> None:\n    \"\"\"\n    Validate publisher namespace format.\n\n    Args:\n        publisher: Publisher namespace (e.g., 'my-org')\n\n    Raises:\n        ExtensionNameError: If publisher is invalid\n    \"\"\"\n    if not publisher:\n        raise ExtensionNameError(\"Publisher cannot be empty\")\n\n    if not PUBLISHER_REGEX.match(publisher):\n        raise ExtensionNameError(\n            \"Publisher must start with a letter and contain only lowercase letters, numbers, and hyphens (e.g., 'my-org')\"","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset-extensions-cli/src/superset_extensions_cli/utils.py#L198-L234","documentation":"validate_npm_package_name in the extensions CLI rejects names whose lowercase form is in the npm reserved list (e.g. node_modules, npm, core, http). The generated frontend package would collide with reserved npm namespaces, so scaffolding stops before writing files.","triggerScenarios":"Scaffolding an extension named 'node_modules', 'npm', 'http-handler' whose normalized npm name equals a reserved word (exact, case-insensitive match).","commonSituations":"Names like 'core', 'http', 'https', 'node_modules' chosen for infrastructure-ish extensions; case variants ('NPM') hitting the case-insensitive check.","solutions":["Pick a non-reserved name, e.g. 'superset-core-ext' instead of 'core'.","Namespace the name under an org prefix so it no longer exactly matches a reserved word.","Check NPM_RESERVED in the CLI source for the current list when automation must pre-filter."],"exampleFix":"# before\n$ superset-extension new npm-tools\n# after\n$ superset-extension new tools-npm","handlingStrategy":"validation","validationCode":"from superset_extensions_cli.utils import NPM_RESERVED\n\ndef npm_name_is_safe(name: str) -> bool:\n    return name.lower() not in NPM_RESERVED","typeGuard":null,"tryCatchPattern":"try:\n    validate_npm_package_name(name)\nexcept ExtensionNameError as e:\n    print(f'Reserve-word collision: {e}')\n    sys.exit(2)","preventionTips":["Prefix generic names (core, http, npm) with an org or topic so they never equal a reserved word exactly.","Remember the check is case-insensitive — 'NPM' is as invalid as 'npm'."],"tags":["cli","validation","npm","scaffolding"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}