{"record":{"id":"e977e907c34521a8","repo":"withastro/astro","slug":"integration-does-not-appear-to-be-a-valid-packa","errorCode":null,"errorMessage":"${integration} does not appear to be a valid package name!","messagePattern":"(.+?) does not appear to be a valid package name!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/astro/src/cli/add/index.ts","lineNumber":856,"sourceCode":"\nasync function validateIntegrations(\n\tintegrations: string[],\n\tflags: yargsParser.Arguments,\n\tlogger: AstroLogger,\n): Promise<IntegrationInfo[]> {\n\t// First, validate all package names to prevent command injection\n\tfor (const integration of integrations) {\n\t\tassertValidPackageName(integration);\n\t}\n\n\tconst spinner = clack.spinner({ withGuide: false });\n\tspinner.start('Resolving packages...');\n\ttry {\n\t\tconst integrationEntries = await Promise.all(\n\t\t\tintegrations.map(async (integration): Promise<IntegrationInfo> => {\n\t\t\t\tconst parsed = parseIntegrationName(integration);\n\t\t\t\tif (!parsed) {\n\t\t\t\t\tthrow new Error(`${bold(integration)} does not appear to be a valid package name!`);\n\t\t\t\t}\n\t\t\t\tlet { scope, name, tag } = parsed;\n\t\t\t\tlet pkgJson;\n\t\t\t\tlet pkgType: 'first-party' | 'third-party';\n\n\t\t\t\tif (scope && scope !== '@astrojs') {\n\t\t\t\t\tpkgType = 'third-party';\n\t\t\t\t} else {\n\t\t\t\t\tconst firstPartyPkgCheck = await fetchPackageJson('@astrojs', name, tag);\n\t\t\t\t\tif (firstPartyPkgCheck instanceof Error) {\n\t\t\t\t\t\tif (firstPartyPkgCheck.message) {\n\t\t\t\t\t\t\tspinner.message(yellow(firstPartyPkgCheck.message));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tspinner.message(yellow(`${bold(integration)} is not an official Astro package.`));\n\t\t\t\t\t\tif (!(await askToContinue({ flags, logger }))) {\n\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`No problem! Find our official integrations at ${cyan(\n\t\t\t\t\t\t\t\t\t'https://astro.build/integrations',","sourceCodeStart":838,"sourceCodeEnd":874,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/astro/src/cli/add/index.ts#L838-L874","documentation":"During `astro add`, each requested integration string is parsed by parseIntegrationName (via parseNpmName). If parsing returns null the spec is not a recognizable npm package spec, and `astro add` throws this Error naming the offending input. This runs after assertValidPackageName, so the spec passed the injection guard but still is not a valid npm name.","triggerScenarios":"Passing an argument to `astro add` that is not a valid scoped/unscoped npm package spec — e.g. a URL, a path, a name with illegal characters, an empty string, a bare version, or a malformed scoped spec like `@/foo`.","commonSituations":"Typing `astro add https://example.com/x`; passing `astro add @astrojs`; forgetting the package name within a scope; copy-pasting a registry URL instead of the package name; shell-quoting that drops part of the argument.","solutions":["Use the npm package name only: `astro add @astrojs/tailwind`, `astro add react`.","For a scoped third-party package, include the full scope: `astro add @myorg/integration`.","Omit registry URLs, versions prefixed wrongly, and file paths.","Re-run with the corrected argument; double-check shell escaping of `@` and `/`."],"exampleFix":"# before\nastro add https://registry.npmjs.org/@astrojs/react\nastro add @astrojs\n\n# after\nastro add @astrojs/react","handlingStrategy":"validation","validationCode":"function isValidNpmSpec(spec: string): boolean {\n  return /^(?:@[a-z0-9-~][a-z0-9-._~]*\\/)?[a-z0-9-~][a-z0-9-._~]*(?:@[^@]+)?$/.test(spec);\n}","typeGuard":"function isNpmPackageName(v: unknown): v is string {\n  return typeof v === 'string' && /^(?:@[a-z0-9-~][a-z0-9-._~]*\\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(v);\n}","tryCatchPattern":null,"preventionTips":["Pass only the package name to `astro add` (no URL, no path).","Quote scoped names in your shell to protect @ and /.","Copy integration names from astro.build/integrations."],"tags":["cli","astro-add","npm","validation"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}