{"record":{"id":"68fc77ee7f665bee","repo":"remotion-dev/remotion","slug":"packagename-must-be-a-valid-npm-package-name","errorCode":null,"errorMessage":"packageName must be a valid npm package name.","messagePattern":"packageName must be a valid npm package name\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/studio/src/components/WebMcp.tsx","lineNumber":409,"sourceCode":"\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\tdescription: 'The npm package name to install.',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tversion: {\n\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t'An optional exact semantic version. Omit it to use the recommended version.',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\trequired: ['packageName'],\n\t\t\t\t\t\tadditionalProperties: false,\n\t\t\t\t\t},\n\t\t\t\t\tannotations: {readOnlyHint: false},\n\t\t\t\t\texecute: async ({packageName, version}) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttypeof packageName !== 'string' ||\n\t\t\t\t\t\t\t!isValidPackageName(packageName)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new Error('packageName must be a valid npm package name.');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tversion !== undefined &&\n\t\t\t\t\t\t\t(typeof version !== 'string' ||\n\t\t\t\t\t\t\t\t!/^[0-9]+\\.[0-9]+\\.[0-9]+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/.test(\n\t\t\t\t\t\t\t\t\tversion,\n\t\t\t\t\t\t\t\t))\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new Error('version must be an exact semantic version.');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait installPackages([\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: packageName,\n\t\t\t\t\t\t\t\tversion: typeof version === 'string' ? version : null,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]);","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/studio/src/components/WebMcp.tsx#L391-L427","documentation":"The WebMcp package-install tool validates packageName with isValidPackageName before installing. An invalid or non-string name is rejected to prevent installing malformed or malicious npm identifiers.","triggerScenarios":"Calling the install tool with packageName missing, not a string, or failing npm name rules (e.g. uppercase, spaces, leading dots/underscores, empty, scoped name typos like '@scope' without slash).","commonSituations":"MCP agents passing guessed package names; typos like 'remotion '` or 'Remotion'; attempting to install a local path or git URL instead of an npm name.","solutions":["Pass a valid npm package name, e.g. '@remotion/whisper-webgpu' or 'remotion'.","Verify the name on npm (lowercase, URL-safe, valid scoped form).","Ensure the argument is a string, not null/undefined.","If installing a local package, publish or pack it first — only npm names are accepted."],"exampleFix":"// before\nawait tool.execute({packageName: 'Remotion'});\n// after\nawait tool.execute({packageName: 'remotion'});","handlingStrategy":"validation","validationCode":"const isValidPackageName = (name: unknown): name is string =>\n  typeof name === 'string' && /^(?:@[a-z0-9-~][a-z0-9-._~]*\\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(name);","typeGuard":"const isNpmName = (v: unknown): v is string =>\n  typeof v === 'string' && v.length > 0 && v === v.toLowerCase() && !v.includes(' ');","tryCatchPattern":"try {\n  await installTool({packageName});\n} catch (e) {\n  if (e.message.includes('valid npm package name')) {\n    suggestCorrectNpmName(packageName);\n  }\n}","preventionTips":["Use lowercase, valid npm identifiers.","Copy package names from npm search results.","Never pass paths or URLs as packageName."],"tags":["mcp","npm","validation"],"backgroundTag":"invalid-argument-format","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-09-09T13:27:51.281Z","contentChangedAt":"2026-09-09T13:27:51.281Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}