{"record":{"id":"34f441ac64670861","repo":"pcottle/learnGitBranching","slug":"git-error-options-34f441","errorCode":null,"errorMessage":"git-error-options","messagePattern":"git-error-options","errorType":"exception","errorClass":"GitError","httpStatus":null,"severity":"error","filePath":"src/js/mercurial/commands.js","lineNumber":165,"sourceCode":"        } else {\n          delegate.name = 'branch';\n        }\n      }\n\n      return delegate;\n    }\n  },\n\n  rebase: {\n    regex: /^hg +rebase($|\\s+)/,\n    options: [\n      '-d',\n      '-s',\n      '-b'\n    ],\n    execute: function(engine, command) {\n      var throwE = function() {\n        throw new GitError({\n          msg: intl.str('git-error-options')\n        });\n      };\n\n      var options = command.getOptionsMap();\n      // if we have both OR if we have neither\n      if ((options['-d'] && options['-s']) ||\n          (!options['-d'] && !options['-s'])) {\n      }\n\n      if (!options['-b']) {\n        options['-b'] = ['.'];\n      }\n\n      command.setOptionsMap(options);\n      command.mapDotToHead();\n      options = command.getOptionsMap();\n","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/pcottle/learnGitBranching/blob/5b09d0ff9678cad164f5a7488a279a44f90d7256/src/js/mercurial/commands.js#L147-L183","documentation":"This hg command shim accepts several option flags (-d, -s, -b, ...) and defines throwE(), which raises GitError('git-error-options') whenever the option combination is invalid — specifically when both or neither of the mutually required options are present ('if we have both OR if we have neither').","triggerScenarios":"Calling the command with an options map where the required pair of options are both set, or both absent — throwE() is invoked from the execute path (referenced by dest and commandConfig) whenever the validated combination fails.","commonSituations":"Running the hg bookmark/branch-like command with no options at all, or with the full set of options simultaneously; passing empty options from a scripted harness.","solutions":["Supply exactly one of the relevant option flags (-d, -s, or -b) as documented for this hg command","Check `command.getOptionsMap()` contents before executing when commands are built dynamically"],"exampleFix":"// before\nhg bookmark\n// after\nhg bookmark -d name","handlingStrategy":"validation","validationCode":"const opts = command.getOptionsMap();\nconst count = ['-d','-s','-b'].filter(k => opts[k]).length;\nif (count !== 1) { reject('provide exactly one of -d/-s/-b'); }","typeGuard":"function exactlyOne(map, keys) {\n  return keys.filter(k => Boolean(map[k])).length === 1;\n}","tryCatchPattern":"try { cmd.execute(engine, command); } catch (e) { if (e instanceof GitError && /options/.test(e.msg)) { showUsage(); } else throw e; }","preventionTips":["Supply exactly one required option flag","Test option combinations when writing custom shims"],"tags":["mercurial","options-validation","git-error-options"],"backgroundTag":"invalid-option-combination","analyzedSha":"5b09d0ff9678cad164f5a7488a279a44f90d7256","analyzedAt":"2026-08-27T13:53:49.057Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}