{"record":{"id":"e09bf3425c26667d","repo":"tinyhumansai/openhuman","slug":"unknown-case-name-valid-all-cases-join","errorCode":null,"errorMessage":"unknown case '${name}' (valid: ${ALL_CASES.join(\", \")})","messagePattern":"unknown case '(.+?)' \\(valid: (.+?)\\)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/debug/goals-live.mjs","lineNumber":104,"sourceCode":"      case \"--token\":\n        opts.token = next();\n        break;\n      case \"--workspace\":\n        opts.workspace = next();\n        break;\n      case \"--spawn-core\":\n        opts.spawnCore = true;\n        break;\n      case \"--isolated-workspace\":\n        opts.isolatedWorkspace = true;\n        break;\n      case \"--keep-workspace\":\n        opts.keepWorkspace = true;\n        break;\n      case \"--case\": {\n        const name = next();\n        if (!ALL_CASES.includes(name))\n          throw new Error(`unknown case '${name}' (valid: ${ALL_CASES.join(\", \")})`);\n        opts.cases.push(name);\n        break;\n      }\n      case \"--reset\":\n        opts.reset = true;\n        break;\n      case \"--context\":\n        opts.context = next();\n        break;\n      case \"--model\":\n        opts.model = next();\n        break;\n      case \"--show-thoughts\":\n        opts.showThoughts = true;\n        break;\n      case \"--rpc-timeout-ms\":\n        opts.rpcTimeoutMs = Number(next());\n        break;","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/scripts/debug/goals-live.mjs#L86-L122","documentation":"goals-live.mjs validates every --case value against ALL_CASES = [\"list\", \"add\", \"edit\", \"delete\", \"reflect\", \"list-final\"] before running. The throw fires in parseArgs when the supplied case name is not in that list, and the message helpfully prints the valid set. It is a fail-fast CLI argument check so the script never starts a core, spends tokens, or mutates goals for a case that does not exist.","triggerScenarios":"Running `node scripts/debug/goals-live.mjs --case lst` (typo), `--case reflect-` or any renamed/removed case name; also copying a case name from an older revision of the script or from harness-live-audit-cases.md terminology into --case.","commonSituations":"Typos at the terminal, tab-completion absence in the pnpm debug wrapper, or a case list drift after the script was updated (e.g. list-final added later) while muscle memory or docs reference old names.","solutions":["Re-run with the exact valid name printed in the message, e.g. `--case list` or `--case reflect`","Run `node scripts/debug/goals-live.mjs --help` (or `pnpm debug goals-live -- -h`) to see the current case list","If the name came from docs, check scripts/debug/goals-live-cases.md for the up-to-date case descriptions","Repeat --case flags to run a subset; omit --case entirely to run all six cases"],"exampleFix":"// before\nnode scripts/debug/goals-live.mjs --case lst\n\n// after\nnode scripts/debug/goals-live.mjs --case list","handlingStrategy":"validation","validationCode":"// before invoking the script, assert case names against the same closed set\nconst VALID = [\"list\", \"add\", \"edit\", \"delete\", \"reflect\", \"list-final\"];\nconst cases = argv.filter((a, i) => argv[i - 1] === \"--case\");\nconst bad = cases.filter((c) => !VALID.includes(c));\nif (bad.length) {\n  console.error(`invalid --case values: ${bad.join(\", \")}; valid: ${VALID.join(\", \")}`);\n  process.exit(2);\n}","typeGuard":"const isGoalCase = (name) =>\n  [\"list\", \"add\", \"edit\", \"delete\", \"reflect\", \"list-final\"].includes(name);","tryCatchPattern":null,"preventionTips":["Let the script default to all cases (omit --case) when the exact name is uncertain","Keep scripts/debug/goals-live-cases.md in sync when cases change so docs never advertise dead names","In wrappers, source the valid list from the script itself (grep ALL_CASES) instead of hardcoding"],"tags":["cli","argument-validation","developer-tooling"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}