{"record":{"id":"4d25d9a9157e3d9d","repo":"nodejs/node","slug":"user-cancelled-operation","errorCode":null,"errorMessage":"User cancelled operation","messagePattern":"User cancelled operation","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"deps/npm/lib/trust-cmd.js","lineNumber":156,"sourceCode":"        }\n        if (urlLines.length > 0) {\n          output.standard()\n          output.standard(urlLines.join('\\n'), { [META]: true, redact: false })\n        }\n      }\n      if (pad) {\n        output.standard()\n      }\n    }\n  }\n\n  async confirmOperation (yes) {\n    // Ask for confirmation unless --yes flag is set\n    if (yes === true) {\n      return\n    }\n    if (yes === false) {\n      throw new Error('User cancelled operation')\n    }\n    const confirm = await input.read(\n      () => _read({ prompt: 'Do you want to proceed? (y/N) ', default: 'n' })\n    )\n    const normalized = confirm.toLowerCase()\n    if (['y', 'yes'].includes(normalized)) {\n      return\n    }\n    throw new Error('User cancelled operation')\n  }\n\n  getFrontendUrl ({ pkgName }) {\n    if (this.registryIsDefault) {\n      return new URL(`/package/${pkgName}`, NPM_FRONTEND).toString()\n    }\n    return null\n  }\n","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/npm/lib/trust-cmd.js#L138-L174","documentation":"Thrown by TrustCommand.confirmOperation when the `yes` config resolves to exactly `false`, i.e. the user explicitly passed `--no-yes` (or `--yes=false`). This is the non-interactive hard-decline path: rather than prompting, it aborts immediately. It is distinct from the interactive 'typed n' case (also 'User cancelled operation' but at line 165).","triggerScenarios":"Running `npm trust gitlab ... --no-yes`, or having `yes=false` in config/env, against a create/revoke flow that calls confirmOperation. The check `if (yes === false)` short-circuits before the prompt.","commonSituations":"Automation that deliberately sets --no-yes to forbid mutations; a wrapper script that injects --no-yes; conflicting CI config setting npm_config_yes=false.","solutions":["Pass `--yes` (or `-y`) to auto-confirm, or omit `--no-yes` to get the interactive prompt.","Use `--dry-run` to preview without confirming if you only wanted to inspect.","Remove `yes=false` from .npmrc / environment if it was unintended."],"exampleFix":"// before\nnpm trust gitlab --file .gitlab-ci.yml --project g/p --allow-publish --no-yes\n// after\nnpm trust gitlab --file .gitlab-ci.yml --project g/p --allow-publish --yes","handlingStrategy":"validation","validationCode":"if (config.get('yes') === false) {\n  throw new Error('--no-yes blocks confirmation; pass --yes or omit --no-yes')\n}","typeGuard":"const isExplicitNoYes = (cfg) => cfg.get('yes') === false","tryCatchPattern":"try {\n  await createConfigCommand(...)\n} catch (err) {\n  if (err.message === 'User cancelled operation' && yesFlag === false) {\n    // treat as intentional abort; do not retry\n  } else { throw err }\n}","preventionTips":["Do not pass --no-yes unless you intend to forbid the operation outright.","In automation use --yes to skip prompts, or omit it for an interactive prompt.","Audit .npmrc for `yes=false`."],"tags":["trust","confirmation","user-input","cli-args"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}