{"record":{"id":"edb748f83c867c66","repo":"nodejs/node","slug":"id-of-the-trusted-relationship-to-revoke-must-be-s","errorCode":null,"errorMessage":"ID of the trusted relationship to revoke must be specified with the --id option","messagePattern":"ID of the trusted relationship to revoke must be specified with the --id option","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"deps/npm/lib/commands/trust/revoke.js","lineNumber":36,"sourceCode":"    new Definition('id', {\n      default: null,\n      type: String,\n      description: 'ID of the trusted relationship to revoke',\n      required: true,\n    }),\n    globalDefinitions['dry-run'],\n    globalDefinitions.registry,\n  ]\n\n  async exec (positionalArgs, flags) {\n    const dryRun = this.config.get('dry-run')\n    const pkgName = positionalArgs[0] || (await this.optionalPkgJson()).name\n    if (!pkgName) {\n      throw new Error('Package name must be specified either as an argument or in the package.json file')\n    }\n    const { id } = flags\n    if (!id) {\n      throw new Error('ID of the trusted relationship to revoke must be specified with the --id option')\n    }\n    this.dialogue`Attempting to revoke trusted configuration for package ${pkgName} with id ${id}`\n    if (dryRun) {\n      return\n    }\n    const spec = npa(pkgName)\n    const uri = `/-/package/${spec.escapedName}/trust/${encodeURIComponent(id)}`\n    await otplease(this.npm, this.npm.flatOptions, opts => npmFetch(uri, {\n      ...opts,\n      method: 'DELETE',\n    }))\n    this.dialogue`Revoked trusted configuration for package ${pkgName} with id ${id}`\n  }\n}\n\nmodule.exports = TrustRevoke\n","sourceCodeStart":18,"sourceCodeEnd":53,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/npm/lib/commands/trust/revoke.js#L18-L53","documentation":"Thrown by `npm trust revoke` when the `--id` flag is not provided. The id targets a specific trusted-relationship record to DELETE. The definition marks id as required:true, but this is a runtime guard for the destructured flags value, since flag parsing can yield undefined in some invocation paths.","triggerScenarios":"Running `npm trust revoke <pkg>` without `--id`, or with an empty `--id`. The check fires after the package-name resolution.","commonSituations":"Forgetting the id returned by a prior `npm trust list`; copy-paste losing the id; confusing the trust id with a package version.","solutions":["Run `npm trust list <pkg>` first to obtain the relationship id.","Add `--id <relationship-id>` to the revoke command.","Double-check the id is the trust record id (typically a slug/hash), not the package name or version."],"exampleFix":"// before\nnpm trust revoke @my-scope/my-pkg\n// after\nnpm trust revoke @my-scope/my-pkg --id 01HVabc...","handlingStrategy":"validation","validationCode":"if (!flags.id || typeof flags.id !== 'string') {\n  throw new Error('Revoke requires --id; run `npm trust list <pkg>` to obtain it')\n}","typeGuard":"const hasTrustId = (flags) =>\n  Boolean(flags && typeof flags.id === 'string' && flags.id.length > 0)","tryCatchPattern":"try {\n  await trustRevoke.exec([pkg], flags)\n} catch (err) {\n  if (/--id option/i.test(err.message)) {\n    // first run `npm trust list <pkg>`, capture id, then retry\n  } else { throw err }\n}","preventionTips":["Run `npm trust list <pkg>` first and capture the relationship id.","Treat the id as opaque; never substitute a package name or version.","Script defensively: fail fast if --id is missing rather than relying on the CLI error."],"tags":["validation","trust","cli-args"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}