koala73/worldmonitor · error · Error
response.status === 429 ? 'Rate limited' : `${provider} API
Error message
response.status === 429 ? 'Rate limited' : `${provider} API error` What it means
Server error in summarizeArticle: the LLM provider HTTP call for article summarization returned a non-OK status. 429 is reported as 'Rate limited'; other statuses as a generic provider API error. The status and body are logged and model failure tracking is recorded before this surfaces.
Source
Thrown at server/worldmonitor/news/v1/summarize-article.ts:301
model,
messages: [
{ role: 'system', content: effectiveSystemPrompt },
{ role: 'user', content: userPrompt },
],
temperature: 0.3,
max_tokens: 100,
top_p: 0.9,
...extraBody,
}),
signal: AbortSignal.timeout(25_000),
});
if (!response.ok) {
const errorText = await response.text();
console.error(`[SummarizeArticle:${provider}] API error:`, response.status, errorText);
recordModelFailure(apiUrl, model, response.status, errorText);
await emitSummarizeLlmEvent({ provider, model, ok: false, durationMs: Date.now() - llmStartMs, promptChars: llmPromptChars, reason: `http_${response.status}` });
throw new Error(response.status === 429 ? 'Rate limited' : `${provider} API error`);
}
// HTTP success proves provider/model compatibility. Summary validation
// below is an application-level concern and must not preserve a stale
// model-rejection streak.
recordModelSuccess(apiUrl, model);
const data = await response.json() as any;
const tokens = (data.usage?.total_tokens as number) || 0;
const usage = data.usage as { total_tokens?: number; prompt_tokens?: number; completion_tokens?: number } | undefined;
const message = data.choices?.[0]?.message;
const rawText = typeof message?.content === 'string' ? message.content.trim() : '';
const rawContent = stripThinkingTags(rawText);
if (['brief', 'analysis'].includes(mode) && rawContent.length < 20) {
console.warn(`[SummarizeArticle:${provider}] Output too short after stripping (${rawContent.length} chars), rejecting`);
await emitSummarizeLlmEvent({ provider, model, ok: false, durationMs: Date.now() - llmStartMs, promptChars: llmPromptChars, usage, reason: 'stripped_empty' });
return null;View on GitHub (pinned to a96956387a)
Solutions
- For 429, back off and retry — provider rate limits are the usual cause
- For other statuses, check the logged response body for provider-side errors (auth, quota, malformed request)
- Retry later; transient provider failures often resolve on their own
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at server/worldmonitor/news/v1/summarize-article.ts:301 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of koala73/worldmonitor@a96956387a (2026-08-21).
Data as JSON: /api/errors/11a2adc097506b44.
Report an issue: GitHub.