{"record":{"id":"4f5239e4aff5843c","repo":"affaan-m/ECC","slug":"move-scope-requires-an-explicit-scope-destinat","errorCode":null,"errorMessage":"--move-scope requires an explicit --scope destination.","messagePattern":"--move-scope requires an explicit --scope destination\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/setup.js","lineNumber":113,"sourceCode":"      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);\n    };\n    const onClose = finish(() => {\n      const error = new Error('Readline was closed before an answer was received.');\n      error.code = 'ABORT_ERR';\n      reject(error);\n    });","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/setup.js#L95-L131","documentation":"Thrown by setup.js when --move-scope is set but --scope is undefined. Migrating the plugin to a different scope requires knowing the destination scope, so the combination is rejected up front.","triggerScenarios":"`node scripts/setup.js --move-scope --yes` with no --scope. The user wants to relocate the install but did not say where.","commonSituations":"Assuming move-scope will prompt for a destination (it does not without a TTY); forgetting to add --scope when switching from install to migrate intent.","solutions":["Add an explicit destination: `--move-scope --scope project`.","Ensure the destination scope is valid (user/project/local).","Drop --move-scope if you only want a fresh install at the current scope."],"exampleFix":"# before\nnode scripts/setup.js --move-scope --yes\n# after\nnode scripts/setup.js --move-scope --scope project --yes","handlingStrategy":"validation","validationCode":"const argv = process.argv.slice(2);\nif (argv.includes('--move-scope') && !argv.some(a => a.startsWith('--scope'))) {\n  console.error('--move-scope requires --scope <user|project|local>');\n  process.exit(2);\n}","typeGuard":null,"tryCatchPattern":"try { parseArgs(process.argv); } catch (err) { console.error(err.message); process.exit(2); }","preventionTips":["Make a wrapper that bundles --move-scope with --scope to avoid the mismatch.","Document migration commands as a single canonical example."],"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"}