can1357/oh-my-pi · error · Error
${message.errorMessage ?? "Provider error"}
Error message
${message.errorMessage ?? "Provider error"} What it means
The inference complete() method streams a model message and, if message.stopReason === "error", throws with the provider's errorMessage (defaulting to "Provider error"). This surfaces upstream LLM failures (auth, network, quota, malformed request) from the conventional-commit inference layer, where results are also cached only on success.
Source
Thrown at packages/coding-agent/src/commit/conventional/inference.ts:132
try {
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;View on GitHub (pinned to 9690622007)
Solutions
- Inspect the thrown errorMessage for the specific provider cause
- Verify provider credentials and the configured model id
- Retry on transient network/rate-limit errors; consider the built-in cache which avoids repeat calls
- Reduce input size (smaller diff) if the error indicates context/token limits
Example fix
// before (no key in env) omp commit # -> Provider error: 401 unauthorized // after export ANTHROPIC_API_KEY=sk-... && omp commit
Defensive patterns
Strategy: retry
Validate before calling
if (!process.env.ANTHROPIC_API_KEY && !process.env.OPENAI_API_KEY) {
throw new Error("No provider credentials configured for inference");
} Try / catch
try {
const result = await inference.complete(request);
} catch (err) {
if (err.message === "Provider error" || /rate limit|timeout|5\d\d/i.test(err.message)) {
await Bun.sleep(backoffMs);
return inference.complete(request); // bounded retries
}
throw err;
} Prevention
- Configure and rotate provider API keys before automation runs
- Use bounded exponential backoff for transient provider failures
- Keep prompts (diffs) within model context limits
- Rely on the inference cache to avoid redundant paid calls
When it happens
Trigger: Any complete() call whose underlying provider request ends in an error stop reason: invalid API key, unreachable endpoint, model id not found, context window exceeded (maxTokens: 16384 plus prompt), or provider-side 5xx.
Common situations: Missing/expired credentials in the environment; offline or proxied networks blocking the provider host; requesting a model the account cannot access; oversized diffs pushing the prompt past limits.
Related errors
- ${response.errorMessage ?? "provider error"}
- AI staging request failed: ${response.errorMessage ?? "unkno
- Empty model response
- timed out: {command}
- GPT-5 Harmony leak persisted after ${harmonyRetryAttempt} re
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/56def090fefc6aea.
Report an issue: GitHub.