{"record":{"id":"be49f6a4254cc284","repo":"can1357/oh-my-pi","slug":"install-must-be-source-local-published","errorCode":null,"errorMessage":"--install must be source|local|published","messagePattern":"--install must be source\\|local\\|published","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/metaharness/src/runner.ts","lineNumber":222,"sourceCode":"\t\tconst take = (flag: string): string => {\n\t\t\tif (inlineValue !== null) return inlineValue;\n\t\t\tconst v = argv[i + 1];\n\t\t\tif (v === undefined) throw new Error(`missing value for ${flag}`);\n\t\t\ti++;\n\t\t\treturn v;\n\t\t};\n\t\tswitch (arg) {\n\t\t\tcase \"-m\":\n\t\t\tcase \"--model\":\n\t\t\t\tcfg.models.push(take(arg));\n\t\t\t\tbreak;\n\t\t\tcase \"--agent\":\n\t\t\t\tcfg.agent = take(arg);\n\t\t\t\tbreak;\n\t\t\tcase \"--install\": {\n\t\t\t\tconst v = take(arg);\n\t\t\t\tif (v !== \"source\" && v !== \"local\" && v !== \"published\") {\n\t\t\t\t\tthrow new Error(\"--install must be source|local|published\");\n\t\t\t\t}\n\t\t\t\tcfg.install = v;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"--version\":\n\t\t\t\tcfg.version = take(arg);\n\t\t\t\tbreak;\n\t\t\tcase \"--thinking\":\n\t\t\t\tcfg.thinking = take(arg);\n\t\t\t\tbreak;\n\t\t\tcase \"--tarball\":\n\t\t\t\tcfg.tarball = path.resolve(take(arg));\n\t\t\t\tcfg.install = \"local\";\n\t\t\t\tcfg.build = false;\n\t\t\t\tbreak;\n\t\t\tcase \"--binary\": {\n\t\t\t\tconst p = path.resolve(take(arg));\n\t\t\t\tconst base = path.basename(p);","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/metaharness/src/runner.ts#L204-L240","documentation":"The metaharness runner's parseArgs validates the --install flag against a fixed enum of install modes (source, local, published). If the value passed is anything else, it refuses to run because downstream build/install logic branches on exactly these three modes. This is a fail-fast input validation error, not a runtime failure.","triggerScenarios":"Running the metaharness runner with --install set to a misspelled or unsupported value, e.g. `--install src`, `--install Source`, `--install npm`, or `--install` with a value containing stray quotes/whitespace from a script.","commonSituations":"CI scripts templating the flag with a wrong variable; users guessing flag values from memory instead of --help; copying an example from another harness that used different install-mode names.","solutions":["Check `runner --help` and use exactly one of: source, local, published.","Fix the value in your script/config — the comparison is case-sensitive lowercase, so 'Source' fails.","If you intended a different install strategy, omit --install entirely to use the default.","Add quoting validation in shell scripts that interpolate the value: `${INSTALL_MODE:?}` and verify it before invoking."],"exampleFix":"// before\nrunner --install src\n// after\nrunner --install source","handlingStrategy":"validation","validationCode":"const INSTALL_MODES = [\"source\",\"local\",\"published\"];\nif (install !== undefined && !INSTALL_MODES.includes(install)) {\n  throw new Error(`--install must be one of ${INSTALL_MODES.join(\"|\")}, got: ${install}`);\n}","typeGuard":"function isInstallMode(v: unknown): v is \"source\"|\"local\"|\"published\" {\n  return v === \"source\" || v === \"local\" || v === \"published\";\n}","tryCatchPattern":"try {\n  await runHarness({ install });\n} catch (e) {\n  if (e instanceof Error && e.message.includes(\"--install must be\")) {\n    console.error(`Bad install mode '${install}'. Use source|local|published.`);\n    process.exitCode = 2;\n  } else throw e;\n}","preventionTips":["Keep the install mode in a single constant shared by scripts and CI.","Validate interpolated shell variables before invoking the runner.","Copy flag values from --help output, not from memory."],"tags":["cli","argument-validation","enum"],"backgroundTag":"invalid-cli-flag-value","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}