can1357/oh-my-pi · error · Error

--install must be source|local|published

Error message

--install must be source|local|published

What it means

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.

Source

Thrown at packages/metaharness/src/runner.ts:222

		const take = (flag: string): string => {
			if (inlineValue !== null) return inlineValue;
			const v = argv[i + 1];
			if (v === undefined) throw new Error(`missing value for ${flag}`);
			i++;
			return v;
		};
		switch (arg) {
			case "-m":
			case "--model":
				cfg.models.push(take(arg));
				break;
			case "--agent":
				cfg.agent = take(arg);
				break;
			case "--install": {
				const v = take(arg);
				if (v !== "source" && v !== "local" && v !== "published") {
					throw new Error("--install must be source|local|published");
				}
				cfg.install = v;
				break;
			}
			case "--version":
				cfg.version = take(arg);
				break;
			case "--thinking":
				cfg.thinking = take(arg);
				break;
			case "--tarball":
				cfg.tarball = path.resolve(take(arg));
				cfg.install = "local";
				cfg.build = false;
				break;
			case "--binary": {
				const p = path.resolve(take(arg));
				const base = path.basename(p);

View on GitHub (pinned to 9690622007)

Solutions

  1. Check `runner --help` and use exactly one of: source, local, published.
  2. Fix the value in your script/config — the comparison is case-sensitive lowercase, so 'Source' fails.
  3. If you intended a different install strategy, omit --install entirely to use the default.
  4. Add quoting validation in shell scripts that interpolate the value: `${INSTALL_MODE:?}` and verify it before invoking.

Example fix

// before
runner --install src
// after
runner --install source
Defensive patterns

Strategy: validation

Validate before calling

const INSTALL_MODES = ["source","local","published"];
if (install !== undefined && !INSTALL_MODES.includes(install)) {
  throw new Error(`--install must be one of ${INSTALL_MODES.join("|")}, got: ${install}`);
}

Type guard

function isInstallMode(v: unknown): v is "source"|"local"|"published" {
  return v === "source" || v === "local" || v === "published";
}

Try / catch

try {
  await runHarness({ install });
} catch (e) {
  if (e instanceof Error && e.message.includes("--install must be")) {
    console.error(`Bad install mode '${install}'. Use source|local|published.`);
    process.exitCode = 2;
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/be49f6a4254cc284. Report an issue: GitHub.