{"record":{"id":"c4f08492b1fc9bf8","repo":"rohitg00/agentmemory","slug":"empty-provider-response","errorCode":"empty_provider_response","errorMessage":"empty_provider_response","messagePattern":"empty_provider_response","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/functions/summarize.ts","lineNumber":319,"sourceCode":"              observationCount: compressed.length,\n              attempt,\n            });\n            continue;\n          }\n          summary = parseSummaryXml(\n            response,\n            sessionId,\n            session.project,\n            compressed.length,\n          );\n          if (summary) break;\n          logger.warn(\"Failed to parse summary XML\", { sessionId, attempt });\n        }\n\n        if (!response || !response.trim()) {\n          const latencyMs = Date.now() - startMs;\n          if (metricsStore) {\n            await metricsStore.record(\"mem::summarize\", latencyMs, false);\n          }\n          return { success: false, error: \"empty_provider_response\" };\n        }\n\n        if (!summary) {\n          const latencyMs = Date.now() - startMs;\n          if (metricsStore) {\n            await metricsStore.record(\"mem::summarize\", latencyMs, false);\n          }\n          return { success: false, error: \"parse_failed\" };\n        }\n\n        const summaryForValidation = {\n          title: summary.title,\n          narrative: summary.narrative,\n          keyDecisions: summary.keyDecisions,\n          filesModified: summary.filesModified,\n          concepts: summary.concepts,","sourceCodeStart":301,"sourceCodeEnd":337,"githubUrl":"https://github.com/rohitg00/agentmemory/blob/e04ba88819c365c9acf9d6661ea802143e728bd6/src/functions/summarize.ts#L301-L337","documentation":"mem::summarize requests a summary from the configured LLM provider and, after the retry loop, checks that the response is non-empty. When the provider returns an empty or whitespace-only response, the function records a failed metric and returns success:false with error 'empty_provider_response' instead of attempting to parse an empty string.","triggerScenarios":"registerSummarizeFunction's provider call yields !response || !response.trim() after attempts — e.g. provider returns 200 with empty body, content filtering, or exhausted retries on transient errors.","commonSituations":"Invalid or missing provider API key; provider outage or rate limiting; model content policy blocking the prompt; misconfigured base URL hitting an empty endpoint; token budget of zero.","solutions":["Check provider API key, base URL, and model configuration; test with a direct API call.","Retry later if the provider is rate-limiting or having an outage.","Switch to a different provider/model via configuration.","Review daemon logs to confirm the request was actually sent and what came back."],"exampleFix":"// before\n// provider: { baseUrl: \"\" } — empty responses\n// after\n// provider: { baseUrl: \"https://api.provider.com/v1\", apiKey: process.env.PROVIDER_API_KEY, model: \"...\" }","handlingStrategy":"fallback","validationCode":"// validate provider config before calling summarize\nif (!process.env.PROVIDER_API_KEY) throw new Error(\"missing provider API key\");\nconst ping = await fetch(provider.baseUrl);","typeGuard":"function isEmptyProviderResponse(res: unknown): res is { success: false; error: \"empty_provider_response\" } {\n  return typeof res === \"object\" && res !== null && (res as any).error === \"empty_provider_response\";\n}","tryCatchPattern":"const res = await sdk.trigger({ function_id: \"mem::summarize\", payload: { sessionId } });\nif (isEmptyProviderResponse(res)) {\n  // fall back to a secondary provider or degrade to raw observations\n}","preventionTips":["Verify API keys and base URLs with a trivial provider call during setup.","Set up a secondary/fallback provider for outages.","Watch provider status pages and rate-limit headers.","Ensure token budget/limits are non-zero in provider config."],"tags":["llm","provider","empty-response","configuration"],"backgroundTag":"empty-llm-response","analyzedSha":"e04ba88819c365c9acf9d6661ea802143e728bd6","analyzedAt":"2026-08-30T01:07:40.754Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}