{"record":{"id":"dfa4dfad1882eb4a","repo":"ReactiveX/rxjs","slug":"unknown-mode-mode","errorCode":null,"errorMessage":"Unknown mode: ${mode}","messagePattern":"Unknown mode: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/migrate/src/cli.ts","lineNumber":140,"sourceCode":"  for (let index = 0; index < argv.length; index++) {\n    const argument = argv[index];\n    if (!argument) continue;\n    switch (argument) {\n      case '--source-root':\n        options.sourceRoot = requiredValue(argv, ++index, argument);\n        break;\n      case '--out-dir':\n        options.outputRoot = requiredValue(argv, ++index, argument);\n        break;\n      case '--source-repo':\n        options.repository = requiredValue(argv, ++index, argument);\n        break;\n      case '--source-sha':\n        options.sha = requiredValue(argv, ++index, argument);\n        break;\n      case '--mode': {\n        const mode = requiredValue(argv, ++index, argument);\n        if (mode !== 'cold' && mode !== 'platform') throw new Error(`Unknown mode: ${mode}`);\n        options.mode = mode;\n        break;\n      }\n      case '--framework': {\n        const framework = requiredValue(argv, ++index, argument);\n        if (framework !== 'preserve' && framework !== 'mocha-chai-vitest') throw new Error(`Unknown framework: ${framework}`);\n        options.framework = framework;\n        break;\n      }\n      case '--write':\n        options.write = true;\n        break;\n      case '--help':\n      case '-h':\n        options.help = true;\n        break;\n      default:\n        if (argument.startsWith('-')) throw new Error(`Unknown option: ${argument}`);","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/ReactiveX/rxjs/blob/54796b38a57e6309f9861e174737479bb3f63f61/packages/migrate/src/cli.ts#L122-L158","documentation":"Thrown by parseArguments in the @rxjs/migrate CLI when the value passed to --mode is not one of the supported modes. The CLI only accepts 'cold' (RxJS 7-style cold observable semantics) or 'platform' (native Observable platform semantics); any other string aborts argument parsing before migration runs.","triggerScenarios":"Running the CLI with an invalid --mode value, e.g. `rxjs-migrate --mode hot ...`, `--mode rxjs8`, or a typo like `--mode platfrom`. Also triggered when the next token after --mode starts with '-' (via requiredValue) or is missing.","commonSituations":"Assuming mode names from older migration tooling or docs (e.g. 'v8', 'next', 'hot'), copy-pasting commands from an out-of-date migration guide, or shell quoting mistakes that shift the argument position.","solutions":["Set --mode to exactly 'cold' or 'platform'","Run with --help to list accepted flag values","Check for typos or trailing whitespace/shell quoting in the mode value"],"exampleFix":"// before\nnpx @rxjs/migrate --mode hot --source-root src ...\n// after\nnpx @rxjs/migrate --mode platform --source-root src ...","handlingStrategy":"validation","validationCode":"const MODES = new Set(['cold', 'platform']);\nif (!MODES.has(mode)) {\n  console.error(`--mode must be one of ${[...MODES].join(' | ')}`);\n  process.exitCode = 1;\n}","typeGuard":"const isMigrationMode = (v: string): v is 'cold' | 'platform' => v === 'cold' || v === 'platform';","tryCatchPattern":"try { runCli(argv); } catch (e) { console.error((e as Error).message); /* message already lists the offending value */ }","preventionTips":["Validate mode against a literal union before invoking the CLI","Keep a typed options object so invalid modes fail at compile time in wrappers"],"tags":["cli","argument-validation","migration"],"backgroundTag":"invalid-cli-argument","analyzedSha":"54796b38a57e6309f9861e174737479bb3f63f61","analyzedAt":"2026-08-28T10:21:27.410Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}