can1357/oh-my-pi · error · Error

Empty model response

Error message

Empty model response

What it means

The conventional-commit inference pipeline sends a prompt to the LLM and extracts the assistant reply with extractAssistantText. If the message returned by the provider has an empty or whitespace-only text payload (and stopReason is not 'error'), this error is thrown because there is nothing to parse into a commit message/analysis.

Source

Thrown at packages/coding-agent/src/commit/conventional/inference.ts:133

				this.#onProgress?.(request.progressLabel);
				const timeout = AbortSignal.timeout(120_000);
				const signal = this.#signal ? AbortSignal.any([this.#signal, timeout]) : timeout;
				const message = await completeSimple(
					target.model,
					{
						systemPrompt: request.systemPrompt.trim() ? [request.systemPrompt] : undefined,
						messages: [{ role: "user", content: request.userPrompt, timestamp: Date.now() }],
					},
					{
						apiKey: target.apiKey,
						maxTokens: 16_384,
						reasoning,
						signal,
					},
				);
				responseText = extractAssistantText(message);
				if (message.stopReason === "error") throw new Error(message.errorMessage ?? "Provider error");
				if (!responseText.trim()) throw new Error("Empty model response");
				const raw = { text: responseText, stopReason: message.stopReason };
				const parsed = parse(raw);
				if (request.cacheable !== false) {
					this.#cache?.put({
						key,
						model: modelKey,
						operation: request.operation,
						request: requestJson,
						response: {
							text: responseText,
							stopReason: message.stopReason,
							costUsd: message.usage.cost.total,
						},
					});
				}
				this.#cache?.recordUsage(modelKey, request.operation, message.usage);
				return parsed;
			} catch (error) {

View on GitHub (pinned to 9690622007)

Solutions

  1. Retry the generation; transient provider issues often cause empty responses
  2. Switch the commit model to a standard chat/instruct model via the model override settings
  3. Check the provider dashboard/status for outages and verify the API key has quota
  4. If using a reasoning model, verify thinking configuration allows final text output

Example fix

// before: empty text bubbles up as 'Empty model response'
const msg = await complete(prompt);
// after: validate before parsing and retry once
let msg = await complete(prompt);
if (!extractAssistantText(msg).trim()) msg = await complete(prompt);
Defensive patterns

Strategy: retry

Validate before calling

const text = extractAssistantText(message);
if (!text || !text.trim()) { /* skip parse, retry */ }

Type guard

function hasModelText(m: { text: string }): boolean {
  return typeof m.text === "string" && m.text.trim().length > 0;
}

Try / catch

try {
  const msg = await inference.complete(prompt);
} catch (err) {
  if (err instanceof Error && err.message === "Empty model response") {
    // retry once, then fall back to a manual commit message
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling complete() when the model returns an empty assistant message: provider truncation, the model emitted only reasoning/thinking content with no final text, a content filter stripped the response, or the provider returned an empty choice for the configured commit model.

Common situations: Misconfigured commit model (e.g. a reasoning-only or non-chat model), provider outage or degraded routing, max_tokens set too low so the model never produces output, or an API tier that silently returns empty completions.

Related errors


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