can1357/oh-my-pi · error · Error

${label} failed: ${reason}

Error message

${label} failed: ${reason}

What it means

`executeWithBudget` runs an initialization/setup code snippet with cancellation and timeout support. If the snippet reports status "error", it throws `"<label> failed: <reason>"` with the kernel-reported error value (or a default "init failed" message). This wraps kernel-side failures during setup (e.g. prelude/bootstrap code) into a single actionable error.

Source

Thrown at packages/coding-agent/src/eval/kernel-base.ts:606

		}
		const timer =
			timeoutMs > 0
				? setTimeout(() => controller.abort(createAbortError("TimeoutError", `${label} timed out`)), timeoutMs)
				: undefined;
		if (timer) cleanups.push(() => clearTimeout(timer));
		try {
			throwIfAborted(controller.signal, label);
			const result = await this.execute(code, {
				signal: controller.signal,
				silent: true,
				storeHistory: false,
			} as TExecuteOptions);
			if (result.cancelled) {
				throw createAbortError(result.timedOut ? "TimeoutError" : "AbortError", `${label} cancelled`);
			}
			if (result.status === "error") {
				const reason = result.error?.value ?? `${this.#options.languageName} kernel init failed`;
				throw new Error(`${label} failed: ${reason}`);
			}
		} finally {
			for (const cleanup of cleanups) cleanup();
		}
	}

	#waitForExitWithTimeout(timeoutMs: number): Promise<number | null> {
		if (!this.#exitedPromise) return Promise.resolve(0);
		const exitedPromise = this.#exitedPromise;
		const timeout = new Promise<null>(resolve => {
			const timer = setTimeout(() => resolve(null), Math.max(0, timeoutMs));
			timer.unref?.();
		});
		return Promise.race([exitedPromise.then(code => code as number | null), timeout]);
	}
}

View on GitHub (pinned to 9690622007)

Solutions

  1. Read the embedded `reason` (the kernel error value) — it names the actual init failure
  2. Fix the prelude/init code that fails (syntax, missing dependency, unsupported API)
  3. Verify the language runtime/interpreter version supports the init script

Example fix

// before: init prelude uses unavailable API
const sys = await import("node:foo"); // fails in kernel realm
// after
const fs = await import("node:fs"); // supported module
Defensive patterns

Strategy: try-catch

Validate before calling

// validate the init script against the target runtime before start
// e.g. ensure imports used by the prelude exist in the kernel realm
for (const mod of requiredModules) {
  if (!supportedModules.has(mod)) throw new Error(`prelude needs unsupported module ${mod}`);
}

Try / catch

try {
  await kernel.start();
} catch (err) {
  if (err instanceof Error && / failed: /.test(err.message)) {
    logger.error("kernel init failed", { reason: err.message });
    // fix prelude or restart with a minimal prelude
  }
}

Prevention

When it happens

Trigger: Kernel bootstrap/prelude code executed via `executeWithBudget` (called from `start`) returns a result with `status === "error"` — e.g. the init script raised an exception, or the execution was cut short by error after partial failure.

Common situations: A bad prelude/config injected into the kernel raising on startup; a kernel that starts but fails importing required modules during init; version drift between the eval harness and the kernel runtime causing init script incompatibility.

Related errors


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