{"record":{"id":"dc1323297e9e1570","repo":"pcottle/learnGitBranching","slug":"bad-numeric-argument-generalargs-1","errorCode":null,"errorMessage":"Bad numeric argument: ' + generalArgs[1]","messagePattern":"Bad numeric argument: ' \\+ generalArgs\\[1\\]","errorType":"exception","errorClass":"GitError","httpStatus":null,"severity":"error","filePath":"src/js/git/commands.js","lineNumber":366,"sourceCode":"          branch = 'main';\n          numToMake = 1;\n          break;\n\n        // git fakeTeamwork 10 or git fakeTeamwork foo\n        case 1:\n          if (isNaN(parseInt(generalArgs[0], 10))) {\n            branch = validateOriginBranchName(engine, generalArgs[0]);\n            numToMake = 1;\n          } else {\n            numToMake = parseInt(generalArgs[0], 10);\n            branch = 'main';\n          }\n          break;\n\n        case 2:\n          branch = validateOriginBranchName(engine, generalArgs[0]);\n          if (isNaN(parseInt(generalArgs[1], 10))) {\n            throw new GitError({\n              msg: 'Bad numeric argument: ' + generalArgs[1]\n            });\n          }\n          numToMake = parseInt(generalArgs[1], 10);\n          break;\n\n      }\n\n      // make sure its a branch and exists\n      var destBranch = engine.origin.resolveID(branch);\n      if (destBranch.get('type') !== 'branch') {\n        throw new GitError({\n          msg: intl.str('git-error-options')\n        });\n      }\n\n      engine.fakeTeamwork(numToMake, branch);\n    }","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/pcottle/learnGitBranching/blob/5b09d0ff9678cad164f5a7488a279a44f90d7256/src/js/git/commands.js#L348-L384","documentation":"fakeTeamwork's two-arg form parses generalArgs[1] as a count; parseInt yields NaN so the argument isn't numeric and a GitError with a plain (non-i18n) message is thrown.","triggerScenarios":"git fakeTeamwork main abc or git fakeTeamwork main two.","commonSituations":"Passing the branch and count in the wrong order; typing a word instead of a number.","solutions":["Pass a numeric count: git fakeTeamwork <branch> <number>","Reorder args — branch first, integer count second"],"exampleFix":"// before\ngit fakeTeamwork two main\n// after\ngit fakeTeamwork main 2","handlingStrategy":"validation","validationCode":"var n = parseInt(args[1], 10); if (isNaN(n)) { prompt for a number; return; }","typeGuard":"function isCountArg(s) { return /^\\d+$/.test(String(s)); }","tryCatchPattern":null,"preventionTips":["Enforce numeric input at the command-line parser/UI","Document arg order: branch then count"],"tags":["git","argument-validation","nan"],"backgroundTag":"invalid-numeric-argument","analyzedSha":"5b09d0ff9678cad164f5a7488a279a44f90d7256","analyzedAt":"2026-08-27T13:53:49.057Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}