{"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":"exception","errorClass":"Error","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/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/setup.js#L89-L125","documentation":"Thrown by setup.js when --scope is provided but is not in VALID_SCOPES ({user, project, local}). Scope determines where the plugin is installed, so an unknown scope is rejected to prevent writing to an unintended location.","triggerScenarios":"Passing `--scope global`, `--scope system`, or any value outside user/project/local.","commonSituations":"Assuming a 'global' scope exists; typos like `--scope usr`; mixing up scope with mode; copy-pasting a scope from a different plugin manager.","solutions":["Choose one of: user, project, or local.","Omit --scope to let the interactive prompt choose.","Remember --move-scope also requires a valid --scope destination."],"exampleFix":"# before\nnode scripts/setup.js --scope global --yes\n# after\nnode scripts/setup.js --scope user --yes","handlingStrategy":"validation","validationCode":"const SCOPES = new Set(['user', 'project', 'local']);\nconst scope = (process.argv.find(a => a.startsWith('--scope')) || '').split('=')[1];\nif (scope !== undefined && !SCOPES.has(scope)) { console.error(`Invalid scope: ${scope}`); process.exit(2); }","typeGuard":"function isValidScope(v) { return v === 'user' || v === 'project' || v === 'local'; }","tryCatchPattern":"try { parseArgs(process.argv); } catch (err) { console.error(err.message); process.exit(2); }","preventionTips":["Share the VALID_SCOPES set with docs and shell completion.","Pre-check scope in CI before running setup."],"tags":["cli","argument-parsing","setup","scope"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}