{"record":{"id":"4f238318909a381c","repo":"pcottle/learnGitBranching","slug":"git-error-args-many-upper-what-git-method","errorCode":null,"errorMessage":"git-error-args-many (upper: {}, what: git {method})","messagePattern":"git-error-args-many \\(upper: (.+?), what: git (.+?)\\)","errorType":"validation","errorClass":"GitError","httpStatus":null,"severity":"error","filePath":"src/js/models/commandModel.js","lineNumber":252,"sourceCode":"  validateArgBounds(args, lower, upper, option) {\n    var what = (option === undefined) ?\n      'git ' + this.get('method') :\n      this.get('method') + ' ' + option + ' ';\n    what = 'with ' + what;\n\n    if (args.length < lower) {\n      throw new GitError({\n        msg: intl.str(\n          'git-error-args-few',\n          {\n            lower: String(lower),\n            what: what\n          }\n        )\n      });\n    }\n    if (args.length > upper) {\n      throw new GitError({\n        msg: intl.str(\n          'git-error-args-many',\n          {\n            upper: String(upper),\n            what: what\n          }\n        )\n      });\n    }\n  }\n\n  validateAtInit() {\n    if (this.get('rawStr') === null) {\n      throw new Error('Give me a string!');\n    }\n    if (!this.get('createTime')) {\n      this.set('createTime', new Date().toString());\n    }","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/pcottle/learnGitBranching/blob/5b09d0ff9678cad164f5a7488a279a44f90d7256/src/js/models/commandModel.js#L234-L270","documentation":"The upper-bound half of validateArgBounds(): when args.length > upper it throws GitError('git-error-args-many') formatted with the upper bound and the command description. This caps how many positional arguments a git/hg command accepts.","triggerScenarios":"Calling validateArgBounds() with more arguments than allowed — e.g. a two-arg command given three: `git rebase arg1 arg2 arg3`, or delegating shims that concatenate option values into general args.","commonSituations":"Paste errors with extra tokens; option values (like -r values) being double-counted as general args in hg shims; commands where quotes were lost so one arg splits into several.","solutions":["Remove the extra arguments so only the documented count remains","Quote multi-word arguments so they parse as a single general arg","If writing a shim, ensure option values aren't also pushed into general args before bounds validation"],"exampleFix":"// before\ngit push origin main extra\n// after\ngit push origin main","handlingStrategy":"validation","validationCode":"if (args.length > upper) { reject(`too many arguments; max ${upper}`); }","typeGuard":"function withinBounds(args, lower, upper) {\n  return args.length >= lower && args.length <= upper;\n}","tryCatchPattern":"try { command.validateArgBounds(args, lower, upper); } catch (e) { if (e instanceof GitError && /many/.test(e.msg)) { trimArgsHint(); } else throw e; }","preventionTips":["Quote multi-word arguments so they parse as one token","Don't re-append option values as positional args in shims"],"tags":["argument-validation","too-many-args","command-model"],"backgroundTag":"too-many-command-arguments","analyzedSha":"5b09d0ff9678cad164f5a7488a279a44f90d7256","analyzedAt":"2026-08-27T13:53:49.057Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}