{"record":{"id":"ad9364d94c93b820","repo":"affaan-m/ECC","slug":"unknown-guided-harness-selection-token","errorCode":null,"errorMessage":"Unknown guided harness selection: ${token}","messagePattern":"Unknown guided harness selection: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/lib/harness-capabilities.js","lineNumber":352,"sourceCode":"  const allTokens = tokens.filter(token => ['all', '*'].includes(normalizeLookupToken(token)));\n  const explicitTokens = tokens.filter(token => !['all', '*'].includes(normalizeLookupToken(token)));\n  if (allTokens.length > 0 && explicitTokens.length > 0) {\n    throw new Error('The all/* harness selection cannot be combined with other selections');\n  }\n  if (allTokens.length > 0) {\n    return GUIDED_HARNESS_IDS.slice();\n  }\n\n  const selected = new Set();\n  for (const token of tokens) {\n    const normalizedToken = normalizeLookupToken(token);\n    const menuIndex = /^\\d+$/.test(normalizedToken) ? Number(normalizedToken) - 1 : -1;\n    const harness = menuIndex >= 0\n      ? listGuidedHarnesses()[menuIndex] || null\n      : getHarnessCapability(token);\n\n    if (!harness) {\n      throw new Error(`Unknown guided harness selection: ${token}`);\n    }\n    if (!harness.guidedReady) {\n      throw new Error(`${harness.label} is an advanced harness and is not guided-ready`);\n    }\n    selected.add(harness.id);\n  }\n\n  if (selected.size === 0) {\n    throw new Error('At least one guided harness must be selected');\n  }\n\n  return GUIDED_HARNESS_IDS.filter(id => selected.has(id));\n}\n\nmodule.exports = {\n  GUIDED_HARNESS_IDS,\n  HARNESS_CAPABILITIES,\n  getHarnessCapability,","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/harness-capabilities.js#L334-L370","documentation":"normalizeHarnessSelection() in scripts/lib/harness-capabilities.js validates user-supplied harness tokens for guided workflows. Each token is either a 1-based menu number or a harness id; it is resolved against listGuidedHarnesses()/getHarnessCapability(). If no harness matches, the function throws 'Unknown guided harness selection' because a guided run must only ever operate on known, guided-capable harnesses.","triggerScenarios":"Calling normalizeHarnessSelection with a token that is neither a valid 1-based menu index (e.g. '0', '99', non-numeric junk) nor a recognized harness id/name (e.g. typo 'claude-codee', or an advanced harness id that getHarnessCapability does resolve — that hits error 231 instead, but an unregistered id hits this one). Exposed through askHarnesses, normalizedHarnesses, selectedHarnessIds, harnesses, and runTests.","commonSituations":"Typos when passing --harness style flags from scripts or CI; passing a numeric index of 0 or one past the end of the guided menu; stale config files naming a harness that was renamed or removed in a newer ECC version; passing an advanced (non-guided) harness that is not in the guided list.","solutions":["Check the token spelling against the ids/names exported by harness-capabilities (list of guided harnesses).","If using a number, use a 1-based index within the guided harness menu (1..listGuidedHarnesses().length).","If the harness is advanced (not guided-ready), use the non-guided workflow or pass a guided-ready harness instead.","If a recent upgrade renamed harnesses, update stored config/scripts to the new ids."],"exampleFix":"// before\nnormalizeHarnessSelection(['claude-codee']); // typo -> throws\n// after\nconst { listGuidedHarnesses } = require('./scripts/lib/harness-capabilities');\nconst ids = listGuidedHarnesses().map(h => h.id);\nconst wanted = ['claude-codee'];\nnormalizeHarnessSelection(wanted.filter(id => ids.includes(id)));","handlingStrategy":"validation","validationCode":"const { listGuidedHarnesses } = require('./scripts/lib/harness-capabilities');\nfunction isValidHarnessToken(token) {\n  const idx = /^\\d+$/.test(token) ? Number(token) - 1 : -1;\n  const guided = listGuidedHarnesses();\n  return idx >= 0 && idx < guided.length || guided.some(h => h.id === token);\n}\nconst tokens = ['claude-code'];\nif (!tokens.every(isValidHarnessToken)) throw new Error('invalid harness token');","typeGuard":"function isGuidedHarness(h) { return h != null && typeof h.id === 'string' && h.guidedReady === true; }","tryCatchPattern":"try {\n  const ids = normalizeHarnessSelection(tokens);\n} catch (err) {\n  if (String(err.message).startsWith('Unknown guided harness selection')) {\n    console.error(`Bad harness token: ${err.message}. Valid: ${listGuidedHarnesses().map(h => h.id).join(', ')}`);\n  } else throw err;\n}","preventionTips":["Source tokens from listGuidedHarnesses().map(h => h.id) rather than hardcoding strings.","Remember menu indices are 1-based, not 0-based.","Validate any stored harness config after upgrading ECC versions.","Keep the guided harness list visible in interactive prompts to reduce typos."],"tags":["cli","validation","harness-selection","unknown-identifier"],"backgroundTag":"invalid-enum-value","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}