continuedev/continue · error · Error

No chat model selected

Error message

No chat model selected

What it means

Thrown by the 'llm/complete' IPC handler when the loaded config has no chat model set (config.selectedModelByRole.chat is undefined). The messenger route refuses to run a completion because there is no model to send the prompt to.

Source

Thrown at core/core.ts:578

      };
    });

    on("llm/streamChat", (msg) => {
      const abortController = this.addMessageAbortController(msg.messageId);
      return llmStreamChat(
        this.configHandler,
        abortController,
        msg,
        this.ide,
        this.messenger,
      );
    });

    on("llm/complete", async (msg) => {
      const { config } = await this.configHandler.loadConfig();
      const model = config?.selectedModelByRole.chat;
      if (!model) {
        throw new Error("No chat model selected");
      }
      const abortController = this.addMessageAbortController(msg.messageId);

      const completion = await model.complete(
        msg.data.prompt,
        abortController.signal,
        msg.data.completionOptions,
      );
      return completion;
    });
    on("llm/listModels", this.handleListModels.bind(this));

    on("llm/compileChat", async (msg) => {
      const { messages, options } = msg.data;
      const model = (await this.configHandler.loadConfig()).config
        ?.selectedModelByRole.chat;

      if (!model) {

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Open config and select a chat model (set models[].roles to include 'chat' or set the default chat model in the GUI)
  2. Verify config.json parses and contains at least one model
  3. If programmatic, ensure initialization/config-writing runs before llm/complete

Example fix

// before
await messenger.send("llm/complete", { messageId, data: { prompt } });
// after
const { config } = await configHandler.loadConfig();
if (!config?.selectedModelByRole.chat) throw new Error("configure a chat model first");
await messenger.send("llm/complete", { messageId, data: { prompt } });
Defensive patterns

Strategy: validation

Validate before calling

const { config } = await configHandler.loadConfig();
if (!config?.selectedModelByRole.chat) {
  throw new Error('Configure a chat model before llm/complete');
}

Type guard

const hasChatModel = (c?: Config): c is Config & { selectedModelByRole: { chat: ILLM } } =>
  !!c?.selectedModelByRole?.chat;

Try / catch

try { await send('llm/complete', msg); } catch (e) { if ((e as Error).message === 'No chat model selected') { promptUserToSelectModel(); } else throw e; }

Prevention

When it happens

Trigger: Sending an 'llm/complete' message from the GUI while config.json has no default chat model (e.g. fresh install, models array empty, or selectedModelByRole.chat was never populated).

Common situations: First-run setup without selecting a model; config.json deleted or corrupted; model entry removed but role mapping not updated; headless/programmatic use before initialization.

Related errors


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/8025d23d67c4a624. Report an issue: GitHub.