can1357/oh-my-pi · error · Error

model is required

Error message

model is required

What it means

resolveArmLaunch requires a per-arm model because the model is one of the few knobs NOT inherited from the experiment's sibling runs — each arm exists to compare a different model. This error means req.model was falsy (missing, empty string, or undefined).

Source

Thrown at packages/metaharness/src/server.ts:121

	try {
		process.kill(pid, 0);
		return true;
	} catch {
		return false;
	}
}

/**
 * Resolve the launch request for a new arm added to an existing experiment.
 * Inherits the experiment's benchmark, dataset, and — crucially — the exact
 * task sample from a sibling arm (its recorded `include`, else its observed
 * trial tasks) so the arm is directly comparable. Only per-arm knobs (model,
 * prewalk, role, note, extra args) come from `req`. Throws if the experiment has
 * no runs to inherit from or the arm name is taken.
 */
export function resolveArmLaunch(store: RunStore, experimentId: string, req: AddArmRequest): LaunchRequest {
	if (!req.arm || /[^\w.-]/.test(req.arm)) throw new Error("arm must be a non-empty [A-Za-z0-9_.-] token");
	if (!req.model) throw new Error("model is required");
	const siblings = store.listRuns().filter(r => experimentOf(r.jobName) === experimentId);
	if (siblings.length === 0) throw new Error(`experiment '${experimentId}' has no runs to inherit from`);
	// Template = the sibling whose recorded `include` list is the longest (the
	// fullest expression of the experiment's sample — partial re-run arms
	// record subsets); among include-less siblings, the most observed trials.
	// listRuns is newest-first so ties keep the newest.
	const strings = (v: unknown): string[] =>
		Array.isArray(v) ? v.filter((x): x is string => typeof x === "string") : [];
	const recordedInclude = (r: RunRow): string[] => strings((r.config as Partial<LaunchRequest>).include);
	const score = (r: RunRow): [number, number] => {
		const recorded = recordedInclude(r).length;
		return recorded > 0 ? [1, recorded] : [0, store.listTraces(r.jobName).length];
	};
	let template = siblings[0];
	let templateScore = score(template);
	for (const r of siblings.slice(1)) {
		const s = score(r);
		if (s[0] > templateScore[0] || (s[0] === templateScore[0] && s[1] > templateScore[1])) {

View on GitHub (pinned to 9690622007)

Solutions

  1. Set req.model to the model id the arm should run (e.g. 'anthropic/claude-sonnet-4').
  2. Check the config/env source that supplies the model — confirm it is populated before the call.
  3. Add a pre-call assertion: if (!req.model) throw new Error('arm model missing').
  4. Verify you are calling resolveArmLaunch and not passing a sibling-run's model field, which is intentionally not inherited.

Example fix

// before
server.addArm(expId, { arm: "arm-b" });
// after
server.addArm(expId, { arm: "arm-b", model: "anthropic/claude-sonnet-4" });
Defensive patterns

Strategy: validation

Validate before calling

if (!req.model || typeof req.model !== "string") {
  throw new Error("addArm requires a model for the new arm");
}

Type guard

const hasModel = (r: { model?: string }): r is { model: string } =>
  typeof r.model === "string" && r.model.length > 0;

Try / catch

try {
  server.addArm(expId, req);
} catch (err) {
  if (err instanceof Error && err.message === "model is required") {
    throw new Error(`arm '${req.arm}' needs a model; check config profile`, { cause: err });
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling resolveArmLaunch/addArm with { arm: 'arm-b' } and no model property; passing model: '' after a failed config lookup; building the request from env vars that are unset.

Common situations: Reading the model from a config file or CLI flag that defaults to undefined; typos like req.models; scripting batch arm creation where one entry omits the model.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


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