{"record":{"id":"6733fa549f409302","repo":"nodejs/node","slug":"package-name-must-be-specified-either-as-an-argume","errorCode":null,"errorMessage":"Package name must be specified either as an argument or in package.json file","messagePattern":"Package name must be specified either as an argument or in package\\.json file","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"deps/npm/lib/commands/trust/circleci.js","lineNumber":118,"sourceCode":"      ...(body.id) && { id: body.id },\n      ...(body.type) && { type: body.type },\n      ...(body.claims?.['oidc.circleci.com/org-id']) && { orgId: body.claims['oidc.circleci.com/org-id'] },\n      ...(body.claims?.['oidc.circleci.com/project-id']) && { projectId: body.claims['oidc.circleci.com/project-id'] },\n      ...(body.claims?.['oidc.circleci.com/pipeline-definition-id']) && {\n        pipelineDefinitionId: body.claims['oidc.circleci.com/pipeline-definition-id'],\n      },\n      ...(body.claims?.['oidc.circleci.com/vcs-origin']) && { vcsOrigin: body.claims['oidc.circleci.com/vcs-origin'] },\n      ...(body.claims?.['oidc.circleci.com/context-ids']) && { contextIds: body.claims['oidc.circleci.com/context-ids'] },\n    }\n  }\n\n  // Override flagsToOptions since CircleCI doesn't use file/entity pattern\n  async flagsToOptions ({ positionalArgs, flags }) {\n    const content = await this.optionalPkgJson()\n    const pkgName = positionalArgs[0] || content.name\n\n    if (!pkgName) {\n      throw new Error('Package name must be specified either as an argument or in package.json file')\n    }\n\n    const orgId = flags['org-id']\n    const projectId = flags['project-id']\n    const pipelineDefinitionId = flags['pipeline-definition-id']\n    const vcsOrigin = flags['vcs-origin']\n    const contextIds = flags['context-id']\n\n    // Validate required flags\n    if (!orgId) {\n      throw new Error('org-id is required')\n    }\n    if (!projectId) {\n      throw new Error('project-id is required')\n    }\n    if (!pipelineDefinitionId) {\n      throw new Error('pipeline-definition-id is required')\n    }","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/npm/lib/commands/trust/circleci.js#L100-L136","documentation":"Thrown by the CircleCI trust provider's `flagsToOptions` when neither a positional argument nor a `package.json` `name` field yields a package name. The trust record needs a package name to bind the OIDC claim to, and it must come from one of those two sources.","triggerScenarios":"`positionalArgs[0]` is falsy and `optionalPkgJson().name` is also falsy/undefined.","commonSituations":"Running the command in a directory without a package.json (or with one lacking a `name`); running outside any package and not passing the name positionally.","solutions":["Pass the package name as the first positional argument to the command.","Add a `\"name\"` field to the local package.json.","Run the command from the package root that contains a valid package.json."],"exampleFix":"// before\nnpm trust circleci --org-id ...   // no name, no package.json\n// after\nnpm trust circleci @myscope/mypkg --org-id ...\n// or add to package.json: \"name\": \"@myscope/mypkg\"","handlingStrategy":"validation","validationCode":"function resolvePkgName(positionalArg, pkgJson) {\n  const name = positionalArg || pkgJson?.name\n  if (!name) {\n    throw new Error('Package name required: pass it positionally or set \"name\" in package.json')\n  }\n  return name\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure package.json has a \"name\" field in every package root.","Pass the package name explicitly when running outside a package directory.","Validate name presence in release/trust scripts."],"tags":["trust","circleci","package-name","argument-validation","oidc"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}