pbakaus/impeccable · error

concept-seed: --reroll must be a non-negative integer

Error message

concept-seed: --reroll must be a non-negative integer

What it means

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}`).

Source

Thrown at plugin/skills/impeccable/scripts/concept-seed.mjs:310

const SEED_MODES = new Set(['persuade', 'operate', 'read', 'experience']);

export function renderConceptSeed({
  scope = 'surface',
  key = process.env.IMPECCABLE_CONCEPT_SEED || crypto.randomBytes(4).toString('hex'),
  reroll = 0,
  register = null,
  mode = null,
  grain = null,
  platform = null,
  candidateCount = 7,
  catalogDir = CATALOG_DIR,
  _resolvedData = undefined,
} = {}) {
  if (scope !== 'surface' && scope !== 'direction') {
    throw new Error('concept-seed: --scope must be direction or surface');
  }
  if (!Number.isInteger(reroll) || reroll < 0) {
    throw new Error('concept-seed: --reroll must be a non-negative integer');
  }
  if (register !== null && register !== 'safer' && register !== 'bolder') {
    throw new Error('concept-seed: --register must be safer or bolder');
  }
  if (register !== null && reroll < 1) {
    throw new Error('concept-seed: --register steers a re-roll round; pass --reroll <n> with it');
  }
  if (register !== null && scope !== 'direction') {
    throw new Error('concept-seed: --register applies to direction rounds only');
  }
  if (mode !== null && !SEED_MODES.has(mode)) {
    throw new Error('concept-seed: --mode must be persuade, operate, read, or experience');
  }
  // Grain needs no mode: how much of the product is in play is independent of
  // which register of work it is.
  if (grain !== null && !COMPOSITION_GRAINS.includes(grain)) {
    throw new Error(`concept-seed: --grain must be one of ${COMPOSITION_GRAINS.join(', ')}`);
  }

View on GitHub (pinned to d14711ae3d)

Solutions

  1. Pass --reroll as a whole number >= 0 (e.g. --reroll 0, --reroll 1, --reroll 2).
  2. If calling programmatically, ensure the value is a JS integer (Number.isInteger) before passing it.

Example fix

// before
seedConcepts({ scope: 'direction', reroll: 1.5 });

// after
seedConcepts({ scope: 'direction', reroll: 2 });
Defensive patterns

Strategy: validation

Validate before calling

if (!Number.isInteger(reroll) || reroll < 0) {
  throw new Error('--reroll must be a non-negative integer');
}

Type guard

function isValidReroll(value) {
  return Number.isInteger(value) && value >= 0;
}

Try / catch

try {
  await seedConcepts({ scope: 'direction', reroll });
} catch (err) {
  if (/--reroll must be a non-negative integer/.test(err.message)) {
    console.error('Pass --reroll as a whole number >= 0.');
  } else throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of pbakaus/impeccable@d14711ae3d (2026-08-13). Data as JSON: /api/errors/0a0f1ee02e47a2de. Report an issue: GitHub.