{"record":{"id":"ca5e8cb15e185283","repo":"Yeachan-Heo/oh-my-codex","slug":"invalid-source-raw-expected-one-of-array","errorCode":null,"errorMessage":"Invalid --source: ${raw}. Expected one of ${Array.from(STEERING_SOURCES).join(', ')}.","messagePattern":"Invalid --source: (.+?)\\. Expected one of (.+?)\\.","errorType":"exception","errorClass":"UltragoalError","httpStatus":null,"severity":"error","filePath":"src/cli/ultragoal.ts","lineNumber":230,"sourceCode":"    cwd: scope.cwd,\n    sessionId: scope.sessionId,\n  });\n}\n\nconst STEERING_KINDS = new Set<UltragoalSteeringMutationKind>(ULTRAGOAL_STEERING_MUTATION_KINDS);\nconst STEERING_SOURCES = new Set<UltragoalSteeringSource>(ULTRAGOAL_STEERING_SOURCES);\n\ntype CliSteerResult = Awaited<ReturnType<typeof steerUltragoal>>;\n\nfunction parseSteeringKind(raw: string | undefined): UltragoalSteeringMutationKind {\n  if (!raw) throw new UltragoalError('Missing --kind for structured ultragoal steer.');\n  if (!STEERING_KINDS.has(raw as UltragoalSteeringMutationKind)) throw new UltragoalError(`Invalid --kind: ${raw}. Expected one of ${Array.from(STEERING_KINDS).join(', ')}.`);\n  return raw as UltragoalSteeringMutationKind;\n}\n\nfunction parseSteeringSource(raw: string | undefined, fallback: UltragoalSteeringSource = 'cli'): UltragoalSteeringSource {\n  if (!raw) return fallback;\n  if (!STEERING_SOURCES.has(raw as UltragoalSteeringSource)) throw new UltragoalError(`Invalid --source: ${raw}. Expected one of ${Array.from(STEERING_SOURCES).join(', ')}.`);\n  return raw as UltragoalSteeringSource;\n}\n\nfunction assertPlainObject(value: unknown, label: string): Record<string, unknown> {\n  if (!value || typeof value !== 'object' || Array.isArray(value)) throw new UltragoalError(`${label} must be a JSON object.`);\n  return value as Record<string, unknown>;\n}\n\nfunction normalizeTargetGoalId(raw: Record<string, unknown>): string | undefined {\n  if (typeof raw.targetGoalId === 'string' && raw.targetGoalId.trim()) return raw.targetGoalId.trim();\n  if (Array.isArray(raw.targetGoalIds)) return raw.targetGoalIds.find((id): id is string => typeof id === 'string' && id.trim().length > 0)?.trim();\n  return undefined;\n}\n\nfunction normalizeSteeringProposal(raw: Record<string, unknown>, _fallbackDirectiveText?: string): UltragoalSteeringProposal {\n  const kind = parseSteeringKind(typeof raw.kind === 'string' ? raw.kind : undefined);\n  const source = parseSteeringSource(typeof raw.source === 'string' ? raw.source : undefined);\n  const after = raw.after && typeof raw.after === 'object' && !Array.isArray(raw.after)","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/ultragoal.ts#L212-L248","documentation":"--source on `omx ultragoal steer` labels where the steering proposal came from and must be one of the ULTRAGOAL_STEERING_SOURCES enum (default 'cli' when omitted). parseSteeringSource throws for any unrecognized string; the accepted list is embedded in the message.","triggerScenarios":"Passing `--source api`, `--source codex`, or a typo'd value not in ULTRAGOAL_STEERING_SOURCES; correct values are typically 'cli', 'agent', etc. per the exported enum.","commonSituations":"Teams piping steering from automation assuming an arbitrary source label works; copy-paste from older docs where the enum was smaller; case sensitivity ('CLI' vs 'cli').","solutions":["Use one of the exact values printed in the error message (e.g. 'cli')","Omit --source to get the default 'cli'","Update to the latest version if you need a new source label that docs advertise"],"exampleFix":"# before\nomx ultragoal steer --kind update_goal --source api ...\n# Error: Invalid --source: api. Expected one of cli, agent.\n\n# after\nomx ultragoal steer --kind update_goal --source agent ...","handlingStrategy":"type-guard","validationCode":"const SOURCES = new Set(ULTRAGOAL_STEERING_SOURCES as readonly string[]);\nif (source && !SOURCES.has(source)) { console.error(`--source must be one of: ${[...SOURCES].join(', ')}`); process.exit(2); }","typeGuard":"function isSteeringSource(v: string, valid: ReadonlySet<string>): v is (typeof ULTRAGOAL_STEERING_SOURCES)[number] {\n  return valid.has(v);\n}","tryCatchPattern":null,"preventionTips":["Omit --source unless you need a non-default provenance label","Lowercase all source values; the enum is case-sensitive"],"tags":["cli","ultragoal","enum","argument-validation"],"backgroundTag":"invalid-cli-flag-value","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}