{"record":{"id":"91aefdac8d4ac9ba","repo":"affaan-m/ECC","slug":"invalid-claude-scope-claudescope","errorCode":null,"errorMessage":"Invalid Claude scope: ${claudeScope}","messagePattern":"Invalid Claude scope: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/multi-harness-setup.js","lineNumber":39,"sourceCode":"  const harnesses = normalizeHarnessSelection(input.harnesses || []);\n  if (harnesses.length === 0) {\n    throw new Error('Choose at least one guided harness: Claude, Codex, or Kimi.');\n  }\n\n  const includesClaude = harnesses.includes('claude');\n  const includesKimi = harnesses.includes('kimi');\n  if (!includesClaude && (input.claudeScope !== undefined || input.claudeHooks !== undefined)) {\n    throw new Error('Claude scope and hook options require Claude to be selected.');\n  }\n  if (!includesKimi && input.profile !== undefined) {\n    throw new Error('The managed install profile requires Kimi to be selected.');\n  }\n\n  const claudeScope = includesClaude ? (input.claudeScope || 'user') : undefined;\n  const claudeHooks = includesClaude ? (input.claudeHooks || 'standard') : undefined;\n  const profile = includesKimi ? (input.profile || 'core') : undefined;\n  if (claudeScope && !VALID_CLAUDE_SCOPES.has(claudeScope)) {\n    throw new Error(`Invalid Claude scope: ${claudeScope}`);\n  }\n  if (claudeHooks && !VALID_CLAUDE_HOOKS.has(claudeHooks)) {\n    throw new Error(`Invalid Claude hooks preference: ${claudeHooks}`);\n  }\n  if (profile && !VALID_PROFILES.has(profile)) {\n    throw new Error(`Invalid Kimi install profile: ${profile}`);\n  }\n\n  return {\n    harnesses,\n    ...(claudeHooks ? { claudeHooks } : {}),\n    ...(claudeScope ? { claudeScope } : {}),\n    dryRun: Boolean(input.dryRun),\n    json: Boolean(input.json),\n    ...(profile ? { profile } : {}),\n    yes: Boolean(input.yes),\n  };\n}","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/lib/multi-harness-setup.js#L21-L57","documentation":"When Claude is selected, claudeScope must be one of the allowed scopes — user, project, or local (the VALID_CLAUDE_SCOPES set). These map to where the Claude plugin config is written (~/.claude, <project>/.claude, or a local overlay). Any other value is rejected because it would direct writes to an unmanaged location. The check only fires when Claude is selected (otherwise claudeScope is undefined).","triggerScenarios":"Calling normalizeGuidedInstallRequest with harnesses including 'claude' and a claudeScope outside {user, project, local}. Examples: 'global', 'system', 'repo', an empty string, or a typo like 'usr'.","commonSituations":"Typing the scope name; assuming 'global' is valid because other tools use it; passing a path instead of the scope keyword; stale config from an older API that accepted different scope names; a UI dropdown with the wrong value list.","solutions":["Use one of the three valid scopes: 'user' (default, writes to ~/.claude), 'project' (writes to <project>/.claude), or 'local'.","Omit claudeScope to accept the default ('user').","If you need a custom install location, that is not supported via claudeScope — use the ECC plugin's own path overrides instead.","Check for typos and trim/case issues — values are matched exactly against the lowercase set."],"exampleFix":"// before\nnormalizeGuidedInstallRequest({ harnesses: ['claude'], claudeScope: 'global' }); // throws\n// after\nnormalizeGuidedInstallRequest({ harnesses: ['claude'], claudeScope: 'project' });\n// or omit for the default\nnormalizeGuidedInstallRequest({ harnesses: ['claude'] });","handlingStrategy":"validation","validationCode":"const { VALID_CLAUDE_SCOPES } = require('./scripts/lib/multi-harness-setup');\nfunction assertClaudeScope(value) {\n  if (value !== undefined && !VALID_CLAUDE_SCOPES.has(value)) {\n    throw new Error(`Invalid Claude scope: ${value}`);\n  }\n  return value;\n}","typeGuard":"function isValidClaudeScope(v) {\n  return v === undefined || new Set(['user','project','local']).has(v);\n}","tryCatchPattern":"try { normalizeGuidedInstallRequest(input); }\ncatch (error) {\n  if (/Invalid Claude scope/i.test(error.message)) {\n    console.error('claudeScope must be one of: user, project, local.');\n    return;\n  }\n  throw error;\n}","preventionTips":["Use only user, project, or local for claudeScope.","Omit claudeScope to accept the default ('user').","Drive dropdowns from VALID_CLAUDE_SCOPES so the UI never offers invalid values.","Watch for typos and synonyms like 'global' or 'system'."],"tags":["multi-harness-setup","validation","configuration","installer","claude"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}