{"record":{"id":"1e41369444743649","repo":"stablyai/orca","slug":"invalid-argument-1e4136","errorCode":"invalid_argument","errorMessage":"Missing required --${name}","messagePattern":"Missing required --(.+?)","errorType":"exception","errorClass":"RuntimeClientError","httpStatus":null,"severity":"error","filePath":"src/cli/flags.ts","lineNumber":9,"sourceCode":"import { RuntimeClientError } from './runtime/types'\nimport { REPEATED_FLAG_SEPARATOR } from './args'\n\nexport function getRequiredStringFlag(flags: Map<string, string | boolean>, name: string): string {\n  const value = flags.get(name)\n  if (typeof value === 'string' && value.length > 0) {\n    return value\n  }\n  throw new RuntimeClientError('invalid_argument', `Missing required --${name}`)\n}\n\nexport function getRequiredStringFlagAllowingEmpty(\n  flags: Map<string, string | boolean>,\n  name: string\n): string {\n  const value = flags.get(name)\n  if (typeof value === 'string') {\n    return value\n  }\n  throw new RuntimeClientError('invalid_argument', `Missing required --${name}`)\n}\n\nexport function getOptionalStringFlag(\n  flags: Map<string, string | boolean>,\n  name: string\n): string | undefined {\n  const value = flags.get(name)","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/cli/flags.ts#L1-L27","documentation":"Thrown by getRequiredStringFlag when the named flag is absent, present as a boolean (valueless), or present as an empty string. This variant demands a non-empty string value, so it rejects `--name` with no argument and `--name ''`. It is the strictest of the string-flag helpers and is used for flags where an empty value is semantically invalid (e.g. op, permission).","triggerScenarios":"flags.get(name) returns undefined, true (a valueless boolean flag), or '' (empty string). This happens when the flag was not parsed, was passed without a value, or was explicitly set to empty.","commonSituations":"A required flag like --op or --permission is omitted entirely, written as a bare `--flag`, or given an empty argument due to shell quoting gone wrong (`--permission \"\"`).","solutions":["Provide the flag with a non-empty value: `--<name> value`.","If an empty string is legitimately valid for your flag, use getRequiredStringFlagAllowingEmpty instead.","If the flag is optional, use getOptionalStringFlag."],"exampleFix":"// before\ngetRequiredStringFlag(flags, 'permission')  // flags has no 'permission'\n\n// after\ngetRequiredStringFlag(new Map([...flags, ['permission','CAMERA']]), 'permission')","handlingStrategy":"type-guard","validationCode":"function requireNonEmptyFlag(flags: Map<string, string | boolean>, name: string): string {\n  const v = flags.get(name)\n  if (typeof v !== 'string' || v.length === 0) {\n    throw new Error(`--${name} requires a non-empty string value`)\n  }\n  return v\n}","typeGuard":"function isNonEmptyStringFlag(flags: Map<string, string | boolean>, name: string): boolean {\n  const v = flags.get(name)\n  return typeof v === 'string' && v.length > 0\n}","tryCatchPattern":"try {\n  getRequiredStringFlag(flags, name)\n} catch (e) {\n  if (e instanceof RuntimeClientError && e.code === 'invalid_argument') {\n    // prompt for the missing --name value\n  }\n  throw e\n}","preventionTips":["Pre-validate required flags in your command wrapper before invoking handlers.","Use getRequiredStringFlagAllowingEmpty when '' is a valid value."],"tags":["cli","flags","parsing","invalid-argument"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}