{"record":{"id":"f77a05b33ee00e0f","repo":"vercel/ai","slug":"acp-npm-package-name-is-invalid-json-stringify","errorCode":null,"errorMessage":"ACP npm package name is invalid: ${JSON.stringify(source.packageName)}.","messagePattern":"ACP npm package name is invalid: (.+?)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/harness-acp/src/v1/implementation.ts","lineNumber":319,"sourceCode":"  for (const name of implementation.credentialEnv ?? []) {\n    const value = credentialEnv[name];\n    if (value != null && value.length > 0) {\n      forwardedEnvironment[name] = value;\n    }\n  }\n  return {\n    ...forwardedEnvironment,\n    ...implementation.env,\n  };\n}\n\nfunction validateNpmSimpleSource({\n  source,\n}: {\n  source: ACPNpmSimpleSource;\n}): void {\n  if (!PACKAGE_NAME_REGEXP.test(source.packageName)) {\n    throw new Error(\n      `ACP npm package name is invalid: ${JSON.stringify(source.packageName)}.`,\n    );\n  }\n  if (\n    source.packageVersion != null &&\n    !EXACT_SEMVER_REGEXP.test(source.packageVersion)\n  ) {\n    throw new Error(\n      `ACP npm package version must be an exact semantic version; received ${JSON.stringify(source.packageVersion)}.`,\n    );\n  }\n}\n\nfunction validateEnvironment({\n  env,\n}: {\n  env: Readonly<Record<string, string>> | undefined;\n}): void {","sourceCodeStart":301,"sourceCodeEnd":337,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/harness-acp/src/v1/implementation.ts#L301-L337","documentation":"For 'npm-simple' sources, source.packageName must match a valid npm package name: optional @scope/, lowercase alphanumerics, and only . _ - characters, no leading separators. createACPV1 validates it with PACKAGE_NAME_REGEXP and rejects anything else so the installer does not attempt a doomed npm fetch.","triggerScenarios":"createACPV1 with source.type 'npm-simple' and packageName values like 'Claude ACP', '@scope', 'pkg!', 'UPPERCASE', or an empty string.","commonSituations":"Typo in the package name, using a display name instead of the npm name, wrong case (npm names are case-sensitive and must be lowercase), or trimming a git URL into the packageName field.","solutions":["Use the exact published npm name, lowercase, e.g. '@zed-industries/claude-code-acp' or 'claude-code-acp'.","Run `npm view <name>` to confirm the package exists and the spelling is right.","If you need a non-registry source (git/URL), that is not npm-simple — use the appropriate source type or a command source."],"exampleFix":"// before\ncreateACPV1({ source: { type: 'npm-simple', packageName: 'Claude-Code-ACP' } });\n// after\ncreateACPV1({ source: { type: 'npm-simple', packageName: 'claude-code-acp' } });","handlingStrategy":"validation","validationCode":"const PACKAGE_NAME_REGEXP = /^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/;\nif (!PACKAGE_NAME_REGEXP.test(source.packageName)) {\n  throw new Error(`Invalid npm package name: ${source.packageName}`);\n}","typeGuard":"function isValidNpmPackageName(name) {\n  return typeof name === 'string' && /^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/.test(name);\n}","tryCatchPattern":"try {\n  const impl = createACPV1(settings);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('ACP npm package name is invalid')) {\n    console.error('Use the exact lowercase npm package name, including @scope/ if scoped');\n  }\n  throw err;\n}","preventionTips":["Copy package names directly from npmjs.com or `npm view` output","Keep names lowercase and validate with the npm name rules before configuring","Do not substitute display names, URLs, or file paths for the package name"],"tags":["configuration","validation","npm"],"backgroundTag":"invalid-config-value","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}