affaan-m/ECC · error · Error

--move-scope requires an explicit --scope destination.

Error message

--move-scope requires an explicit --scope destination.

What it means

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.

Source

Thrown at scripts/setup.js:113

      options.json = true;
    } else if (argument === '--help' || argument === '-h') {
      options.help = true;
    } else {
      throw new Error(`Unknown argument: ${argument}`);
    }
  }

  if (options.mode !== undefined && options.mode !== MODE) {
    throw new Error(`Invalid setup mode: ${options.mode}. This command currently supports ${MODE}.`);
  }
  if (options.scope !== undefined && !VALID_SCOPES.has(options.scope)) {
    throw new Error(`Invalid --scope value: ${options.scope}`);
  }
  if (options.hooks !== undefined && !VALID_HOOK_MODES.has(options.hooks)) {
    throw new Error(`Invalid --hooks value: ${options.hooks}`);
  }
  if (options.moveScope && options.scope === undefined) {
    throw new Error('--move-scope requires an explicit --scope destination.');
  }
  return options;
}

function questionWithCancellation(terminal, prompt) {
  return new Promise((resolve, reject) => {
    let settled = false;
    const finish = callback => value => {
      if (settled) return;
      settled = true;
      terminal.removeListener('close', onClose);
      callback(value);
    };
    const onClose = finish(() => {
      const error = new Error('Readline was closed before an answer was received.');
      error.code = 'ABORT_ERR';
      reject(error);
    });

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Add an explicit destination: `--move-scope --scope project`.
  2. Ensure the destination scope is valid (user/project/local).
  3. Drop --move-scope if you only want a fresh install at the current scope.

Example fix

# before
node scripts/setup.js --move-scope --yes
# after
node scripts/setup.js --move-scope --scope project --yes
Defensive patterns

Strategy: validation

Validate before calling

const argv = process.argv.slice(2);
if (argv.includes('--move-scope') && !argv.some(a => a.startsWith('--scope'))) {
  console.error('--move-scope requires --scope <user|project|local>');
  process.exit(2);
}

Try / catch

try { parseArgs(process.argv); } catch (err) { console.error(err.message); process.exit(2); }

Prevention

When it happens

Trigger: `node scripts/setup.js --move-scope --yes` with no --scope. The user wants to relocate the install but did not say where.

Common situations: 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.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/4f5239e4aff5843c. Report an issue: GitHub.