{"record":{"id":"5e002737097862b7","repo":"affaan-m/ECC","slug":"invalid-scope-value-options-scope","errorCode":null,"errorMessage":"Invalid --scope value: ${options.scope}","messagePattern":"Invalid --scope value: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/setup.js","lineNumber":107,"sourceCode":"      options.yes = true;\n    } else if (argument === '--dry-run') {\n      options.dryRun = true;\n    } else if (argument === '--move-scope') {\n      options.moveScope = true;\n    } else if (argument === '--json') {\n      options.json = true;\n    } else if (argument === '--help' || argument === '-h') {\n      options.help = true;\n    } else {\n      throw new Error(`Unknown argument: ${argument}`);\n    }\n  }\n\n  if (options.mode !== undefined && options.mode !== MODE) {\n    throw new Error(`Invalid setup mode: ${options.mode}. This command currently supports ${MODE}.`);\n  }\n  if (options.scope !== undefined && !VALID_SCOPES.has(options.scope)) {\n    throw new Error(`Invalid --scope value: ${options.scope}`);\n  }\n  if (options.hooks !== undefined && !VALID_HOOK_MODES.has(options.hooks)) {\n    throw new Error(`Invalid --hooks value: ${options.hooks}`);\n  }\n  if (options.moveScope && options.scope === undefined) {\n    throw new Error('--move-scope requires an explicit --scope destination.');\n  }\n  return options;\n}\n\nfunction questionWithCancellation(terminal, prompt) {\n  return new Promise((resolve, reject) => {\n    let settled = false;\n    const finish = callback => value => {\n      if (settled) return;\n      settled = true;\n      terminal.removeListener('close', onClose);\n      callback(value);","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/setup.js#L89-L125","documentation":"parseArgs validates --scope against the VALID_SCOPES set (user, project, local per the help text) and throws this when the value is not one of them. The scope determines where the plugin configuration is installed, so only the three enumerated destinations are accepted.","triggerScenarios":"Running `ecc setup --scope global`, `ecc setup --scope repo`, `ecc setup --scope Project`, or any misspelled/unknown scope string.","commonSituations":"Using synonyms from other tools ('global', 'workspace'); case-sensitivity mistakes ('User'); typos ('projekt'); scripts built from outdated documentation listing different scope names.","solutions":["Use one of the exact values: user, project, or local.","Fix casing — the check is case-sensitive, so lowercase the value.","Run `ecc setup --help` to see the 'Install scopes' section listing valid values."],"exampleFix":"// before\nnpm run setup -- --mode claude-plugin --scope global\n\n// after\nnpm run setup -- --mode claude-plugin --scope user","handlingStrategy":"validation","validationCode":"const VALID_SCOPES = new Set(['user', 'project', 'local']);\nif (scopeArg !== undefined && !VALID_SCOPES.has(scopeArg)) {\n  throw new Error(`Invalid --scope value: ${scopeArg}`);\n}","typeGuard":"const isValidScope = (v) => ['user', 'project', 'local'].includes(v);","tryCatchPattern":"try {\n  await runSetup(rawArgs);\n} catch (err) {\n  if (/^Invalid --scope value: /.test(err.message)) {\n    console.error(`${err.message}. Use one of: user, project, local.`);\n    process.exitCode = 2;\n  } else throw err;\n}","preventionTips":["Keep a constant list of the three scopes in your automation config.","Lowercase scope values before passing them (check is case-sensitive).","Validate user-supplied scope in wrappers before spawning the CLI."],"tags":["cli","enum","scope"],"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"}