pbakaus/impeccable · error · Error

concept-seed: --scope must be direction or surface

Error message

concept-seed: --scope must be direction or surface

What it means

Thrown at the top of the concept-seed selection function when the `scope` argument is neither 'surface' nor 'direction'. Scope selects which roll axis runs: surface deals grounded structures, direction deals product worlds. Any other value (including undefined-as-string or a typo) is rejected before any work begins.

Source

Thrown at skill/scripts/concept-seed.mjs:307

  };
}

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.

View on GitHub (pinned to d14711ae3d)

Solutions

  1. Set scope to exactly 'surface' or 'direction' (the default is 'surface', so omitting it is also valid).
  2. If driving from CLI, use --scope surface or --scope direction and check for typos.
  3. Validate the value against the allowed set before calling the function.

Example fix

// before
await seedConcepts({ scope: 'page' });

// after
await seedConcepts({ scope: 'surface' }); // or 'direction'
Defensive patterns

Strategy: type-guard

Type guard

const SCOPES = new Set(['surface', 'direction']);
function isValidScope(v) {
  return v == null || SCOPES.has(v);
}

Prevention

When it happens

Trigger: Passing scope='page', 'product', 'web' (confusing scope with grain/platform); passing an empty string; CLI flag parsing that yields undefined and gets stringified; a programmatic caller using the wrong enum.

Common situations: Confusing scope with grain (product/flow/view/region) or platform (web/ios/android); a typo like 'surfaces' or 'direct'; a caller reading scope from an unvalidated config file.

Related errors


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