{"record":{"id":"c92b8d6b216807e4","repo":"nodejs/node","slug":"please-provide-only-one-of-flaglist","errorCode":null,"errorMessage":"Please provide only one of ${flagList}","messagePattern":"Please provide only one of (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"deps/npm/lib/base-cmd.js","lineNumber":347,"sourceCode":"    if (this.constructor.definitions && this.constructor.definitions.length > 0) {\n      this.#validateFlags(parsed, commandDefinitions, remains)\n    }\n\n    // Check for conflicts between main flags and their aliases\n    // Also map aliases back to their main keys\n    for (const [mainKey, aliases] of Object.entries(aliasMap)) {\n      const providedKeys = []\n      if (mainKey in parsed) {\n        providedKeys.push(mainKey)\n      }\n      for (const alias of aliases) {\n        if (alias in parsed) {\n          providedKeys.push(alias)\n        }\n      }\n      if (providedKeys.length > 1) {\n        const flagList = providedKeys.map(k => `--${k}`).join(' or ')\n        throw new Error(`Please provide only one of ${flagList}`)\n      }\n\n      // If an alias was provided, map it to the main key\n      if (providedKeys.length === 1 && providedKeys[0] !== mainKey) {\n        const aliasKey = providedKeys[0]\n        parsed[mainKey] = parsed[aliasKey]\n        delete parsed[aliasKey]\n      }\n    }\n\n    // Only include keys that are defined in commandDefinitions (main keys only)\n    const filtered = {}\n    for (const def of commandDefinitions) {\n      if (def.key in parsed) {\n        filtered[def.key] = parsed[def.key]\n      }\n    }\n    return [{ ...defaults, ...filtered }, remains]","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/npm/lib/base-cmd.js#L329-L365","documentation":"npm resolves flag aliases (e.g. a short and long form, or two legacy names) to a single canonical key. If two or more names from the same alias group are supplied at once, it cannot decide which value wins, so it throws listing the conflicting flags.","triggerScenarios":"Passing a flag together with its alias, or two aliases of the same option, in one command. Also triggered by a flag set on the CLI that is also present (under an alias) in .npmrc or npm_config_* env vars in some merged configurations.","commonSituations":"Copy-pasting flags from different documentation sources; build scripts that concatenate flag lists; legacy aliases still lingering in npmrc.","solutions":["Read the flag list in the message and keep only one of the names, then re-run","Search .npmrc (user, global, project) and npm_config_* env for an alias of the same option and remove the duplicate","Run with --no-... or the canonical long form only, consulting `npm help config` for the canonical name"],"exampleFix":"# before (two names for the same option)\nnpm publish --tag next --dist-tag next\n\n# after (single canonical flag)\nnpm publish --tag next","handlingStrategy":"validation","validationCode":"// Before building argv, ensure no two names from the same alias group are present\nfunction hasAliasCollision(provided, aliasGroups) {\n  return aliasGroups.some(group => provided.filter(k => group.includes(k)).length > 1)\n}","typeGuard":"function isSingleAliasGroupUse(providedKeys, aliasGroups) {\n  return !hasAliasCollision(providedKeys, aliasGroups)\n}","tryCatchPattern":null,"preventionTips":["Always use the canonical long form of a flag, never its alias, in scripts","Keep flag lists in one place rather than concatenating from multiple sources","Audit .npmrc for legacy alias entries"],"tags":["config-validation","aliases","cli","flags"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}