vercel/ai · error
ACP npm package name is invalid: ${JSON.stringify(source.pac
Error message
ACP npm package name is invalid: ${JSON.stringify(source.packageName)}. What it means
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.
Source
Thrown at packages/harness-acp/src/v1/implementation.ts:319
for (const name of implementation.credentialEnv ?? []) {
const value = credentialEnv[name];
if (value != null && value.length > 0) {
forwardedEnvironment[name] = value;
}
}
return {
...forwardedEnvironment,
...implementation.env,
};
}
function validateNpmSimpleSource({
source,
}: {
source: ACPNpmSimpleSource;
}): void {
if (!PACKAGE_NAME_REGEXP.test(source.packageName)) {
throw new Error(
`ACP npm package name is invalid: ${JSON.stringify(source.packageName)}.`,
);
}
if (
source.packageVersion != null &&
!EXACT_SEMVER_REGEXP.test(source.packageVersion)
) {
throw new Error(
`ACP npm package version must be an exact semantic version; received ${JSON.stringify(source.packageVersion)}.`,
);
}
}
function validateEnvironment({
env,
}: {
env: Readonly<Record<string, string>> | undefined;
}): void {View on GitHub (pinned to 69428b1f8b)
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.
Example fix
// before
createACPV1({ source: { type: 'npm-simple', packageName: 'Claude-Code-ACP' } });
// after
createACPV1({ source: { type: 'npm-simple', packageName: 'claude-code-acp' } }); Defensive patterns
Strategy: validation
Validate before calling
const PACKAGE_NAME_REGEXP = /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/;
if (!PACKAGE_NAME_REGEXP.test(source.packageName)) {
throw new Error(`Invalid npm package name: ${source.packageName}`);
} Type guard
function isValidNpmPackageName(name) {
return typeof name === 'string' && /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(name);
} Try / catch
try {
const impl = createACPV1(settings);
} catch (err) {
if (err instanceof Error && err.message.startsWith('ACP npm package name is invalid')) {
console.error('Use the exact lowercase npm package name, including @scope/ if scoped');
}
throw err;
} Prevention
- 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
When it happens
Trigger: createACPV1 with source.type 'npm-simple' and packageName values like 'Claude ACP', '@scope', 'pkg!', 'UPPERCASE', or an empty string.
Common situations: 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.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- ACP source.packageJson must not be empty.
- ACP source.pnpmWorkspaceYaml must not be empty.
- ACP npm package version must be an exact semantic version; r
- Invalid argument for parameter output: Invalid output type.
- Continuation maxAgeMs must be a positive integer.
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/f77a05b33ee00e0f.
Report an issue: GitHub.