{"record":{"id":"0a0f1ee02e47a2de","repo":"pbakaus/impeccable","slug":"concept-seed-reroll-must-be-a-non-negative-inte","errorCode":null,"errorMessage":"concept-seed: --reroll must be a non-negative integer","messagePattern":"concept-seed: --reroll must be a non-negative integer","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/skills/impeccable/scripts/concept-seed.mjs","lineNumber":310,"sourceCode":"const SEED_MODES = new Set(['persuade', 'operate', 'read', 'experience']);\n\nexport function renderConceptSeed({\n  scope = 'surface',\n  key = process.env.IMPECCABLE_CONCEPT_SEED || crypto.randomBytes(4).toString('hex'),\n  reroll = 0,\n  register = null,\n  mode = null,\n  grain = null,\n  platform = null,\n  candidateCount = 7,\n  catalogDir = CATALOG_DIR,\n  _resolvedData = undefined,\n} = {}) {\n  if (scope !== 'surface' && scope !== 'direction') {\n    throw new Error('concept-seed: --scope must be direction or surface');\n  }\n  if (!Number.isInteger(reroll) || reroll < 0) {\n    throw new Error('concept-seed: --reroll must be a non-negative integer');\n  }\n  if (register !== null && register !== 'safer' && register !== 'bolder') {\n    throw new Error('concept-seed: --register must be safer or bolder');\n  }\n  if (register !== null && reroll < 1) {\n    throw new Error('concept-seed: --register steers a re-roll round; pass --reroll <n> with it');\n  }\n  if (register !== null && scope !== 'direction') {\n    throw new Error('concept-seed: --register applies to direction rounds only');\n  }\n  if (mode !== null && !SEED_MODES.has(mode)) {\n    throw new Error('concept-seed: --mode must be persuade, operate, read, or experience');\n  }\n  // Grain needs no mode: how much of the product is in play is independent of\n  // which register of work it is.\n  if (grain !== null && !COMPOSITION_GRAINS.includes(grain)) {\n    throw new Error(`concept-seed: --grain must be one of ${COMPOSITION_GRAINS.join(', ')}`);\n  }","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/plugin/skills/impeccable/scripts/concept-seed.mjs#L292-L328","documentation":"Thrown when --reroll is not a non-negative integer. Re-roll rounds are indexed from 0 and used to deterministically recompute and exclude prior draws; fractional, negative, or non-numeric values would break the exclusion chain and the salt computation (`index:reroll-${reroll}`).","triggerScenarios":"Passing --reroll with a negative number, a float (e.g. 1.5), a string, or omitting it in a way that yields undefined after coercion. The check is Number.isInteger(reroll) && reroll >= 0.","commonSituations":"CLI parsing hands a string '1' that is not coerced to integer; a wrapper passes a fractional round index; a UI lets a user enter a decimal re-roll count.","solutions":["Pass --reroll as a whole number >= 0 (e.g. --reroll 0, --reroll 1, --reroll 2).","If calling programmatically, ensure the value is a JS integer (Number.isInteger) before passing it."],"exampleFix":"// before\nseedConcepts({ scope: 'direction', reroll: 1.5 });\n\n// after\nseedConcepts({ scope: 'direction', reroll: 2 });","handlingStrategy":"validation","validationCode":"if (!Number.isInteger(reroll) || reroll < 0) {\n  throw new Error('--reroll must be a non-negative integer');\n}","typeGuard":"function isValidReroll(value) {\n  return Number.isInteger(value) && value >= 0;\n}","tryCatchPattern":"try {\n  await seedConcepts({ scope: 'direction', reroll });\n} catch (err) {\n  if (/--reroll must be a non-negative integer/.test(err.message)) {\n    console.error('Pass --reroll as a whole number >= 0.');\n  } else throw err;\n}","preventionTips":["Coerce CLI strings to Number and check Number.isInteger before forwarding.","Clamp UI inputs for re-roll to integers >= 0.","Default reroll to 0 in callers so undefined never reaches the check."],"tags":["concept-seed","validation","reroll","cli-args"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}