{"record":{"id":"597b7916013724de","repo":"ReactiveX/rxjs","slug":"missing-required-argument-missing-length-1","errorCode":null,"errorMessage":"Missing required argument${missing.length === 1 ? '' : 's'}: ${missing.join(', ')}","messagePattern":"Missing required argument(.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/migrate/src/cli.ts","lineNumber":172,"sourceCode":"      case '-h':\n        options.help = true;\n        break;\n      default:\n        if (argument.startsWith('-')) throw new Error(`Unknown option: ${argument}`);\n        options.files.push(argument);\n    }\n  }\n  return options;\n}\n\nfunction validateArguments(options: CliOptions): asserts options is RunnableCliOptions {\n  const missing = [\n    options.files.length === 0 ? 'at least one source file' : undefined,\n    options.sourceRoot ? undefined : '--source-root',\n    options.repository ? undefined : '--source-repo',\n    options.sha ? undefined : '--source-sha',\n  ].filter((value): value is string => value !== undefined);\n  if (missing.length > 0) throw new Error(`Missing required argument${missing.length === 1 ? '' : 's'}: ${missing.join(', ')}`);\n  if (options.write && !options.outputRoot) throw new Error('--out-dir is required with --write');\n}\n\nfunction requiredValue(argv: readonly string[], index: number, option: string): string {\n  const value = argv[index];\n  if (!value || value.startsWith('-')) throw new Error(`${option} requires a value`);\n  return value;\n}\n\nfunction errorReport(code: MigrationCliErrorReport['error']['code'], message: string): MigrationCliErrorReport {\n  return { schemaVersion: migrationCliReportSchemaVersion, status: 'error', error: { code, message } };\n}\n\nfunction writeJson(stream: Pick<NodeJS.WriteStream, 'write'>, value: MigrationCliReport | MigrationCliErrorReport): void {\n  stream.write(`${JSON.stringify(value, null, 2)}\\n`);\n}\n\nfunction messageFor(error: unknown): string {","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/ReactiveX/rxjs/blob/54796b38a57e6309f9861e174737479bb3f63f61/packages/migrate/src/cli.ts#L154-L190","documentation":"Thrown by validateArguments after parsing when one or more required inputs are absent: at least one source file, --source-root, --source-repo, and --source-sha. The message lists every missing item at once so you can fix them in one pass.","triggerScenarios":"Invoking the CLI without positional file arguments, or omitting any of --source-root, --source-repo, or --source-sha. Only fires when --help was not requested.","commonSituations":"First-time use without reading usage, partially copied example commands, or npm scripts that expect variables (${SHA}) that expand to empty strings.","solutions":["Add all flags listed in the message: --source-root, --source-repo, --source-sha","Pass at least one source file/glob as a positional argument","Run with --help to see the full required syntax"],"exampleFix":"# before\nnpx @rxjs/migrate spec/app.spec.ts\n# after\nnpx @rxjs/migrate --source-root . --source-repo https://github.com/org/repo --source-sha abc1234 spec/app.spec.ts","handlingStrategy":"validation","validationCode":"const missing = [\n  files.length === 0 && 'at least one source file',\n  !sourceRoot && '--source-root',\n  !repository && '--source-repo',\n  !sha && '--source-sha',\n].filter(Boolean);\nif (missing.length) throw new Error('Missing: ' + missing.join(', '));","typeGuard":"const hasRequiredCliInput = (o: {files:string[]; sourceRoot?:string; repository?:string; sha?:string}) => o.files.length > 0 && !!o.sourceRoot && !!o.repository && !!o.sha;","tryCatchPattern":"try { runCli(argv); } catch (e) { console.error((e as Error).message); /* lists every missing item at once */ }","preventionTips":["Fail fast in CI when SHA/repo env vars are empty","Keep one canonical, tested command template for the migration"],"tags":["cli","required-arguments","migration"],"backgroundTag":"missing-required-parameter","analyzedSha":"54796b38a57e6309f9861e174737479bb3f63f61","analyzedAt":"2026-08-28T10:21:27.410Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}