can1357/oh-my-pi · critical · Error

No models available in the bundled catalog

Error message

No models available in the bundled catalog

What it means

`runRenderCommand` builds an offline AgentSession using the bundled model catalog via `ModelRegistry.getAll()`. If the first model lookup returns nothing — the bundled catalog is empty/unavailable — the command cannot proceed and throws. This is a hard invariant: rendering requires at least one known model.

Source

Thrown at packages/coding-agent/src/cli/render-cli.ts:198

	const workingCopy = path.join(tempDir.path(), path.basename(sourcePath));

	const width = args.width ?? (process.stdout.isTTY ? process.stdout.columns : undefined) ?? 120;
	const height = args.height ?? (process.stdout.isTTY ? process.stdout.rows : undefined) ?? 40;

	let session: AgentSession | undefined;
	let mode: InteractiveMode | undefined;
	try {
		await fs.copyFile(sourcePath, workingCopy);
		const openStart = performance.now();
		const sessionManager = await SessionManager.open(workingCopy, undefined, undefined, {
			suppressBreadcrumb: true,
		});
		const openMs = performance.now() - openStart;

		const authStorage = new AuthStorage(new SqliteAuthCredentialStore(new Database(":memory:")));
		const modelRegistry = new ModelRegistry(authStorage);
		const model = modelRegistry.getAll()[0];
		if (!model) throw new Error("No models available in the bundled catalog");

		session = new AgentSession({
			agent: new Agent({ initialState: { model, systemPrompt: [], tools: [], messages: [] } }),
			sessionManager,
			settings,
			modelRegistry,
		});
		const terminal = new SinkTerminal(width, height);
		const scheduler = new DrainScheduler();
		const composer = new Composer({
			terminal,
			tuiOptions: { renderScheduler: scheduler },
			preferences: { quiet: true },
		});
		mode = new InteractiveMode(session, VERSION, undefined, undefined, undefined, undefined, undefined, composer);
		await mode.init({ suppressWelcomeIntro: true });
		scheduler.drain();

View on GitHub (pinned to 9690622007)

Solutions

  1. Reinstall/upgrade the omp package so the bundled models.json is present
  2. Check that your build/packaging step isn't excluding the catalog JSON asset
  3. Report the issue if a fresh install still shows an empty catalog — likely a catalog generation bug
  4. Verify with a minimal script that `new ModelRegistry(auth).getAll()` returns entries

Example fix

// before
const model = modelRegistry.getAll()[0];
if (!model) throw new Error("No models available in the bundled catalog");
// after
const models = modelRegistry.getAll();
const model = models[0];
if (!model) throw new Error(`No models available in the bundled catalog (${models.length} entries; check installation)`);
Defensive patterns

Strategy: fallback

Validate before calling

const models = modelRegistry.getAll();
if (models.length === 0) {
  console.error("Bundled model catalog is empty — reinstall the package.");
  process.exit(1);
}

Type guard

function hasModels(registry: ModelRegistry): boolean {
  return registry.getAll().length > 0;
}

Try / catch

try {
  const model = modelRegistry.getAll()[0];
  if (!model) throw new Error("No models available in the bundled catalog");
} catch (err) {
  console.error(`${err instanceof Error ? err.message : err} — reinstall/upgrade omp`);
  process.exit(1);
}

Prevention

When it happens

Trigger: `modelRegistry.getAll()[0]` is undefined because the bundled models.json failed to load, the catalog resource is missing from the build, or an AuthStorage/registry misconfiguration filters everything out.

Common situations: Corrupted or stripped install where the bundled catalog asset is absent; a broken build of the package; future catalog format change making all entries unparsable.

Related errors


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