rohitg00/agentmemory · error

empty_provider_response

empty_provider_response

Error message

empty_provider_response

What it means

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.

Source

Thrown at src/functions/summarize.ts:319

              observationCount: compressed.length,
              attempt,
            });
            continue;
          }
          summary = parseSummaryXml(
            response,
            sessionId,
            session.project,
            compressed.length,
          );
          if (summary) break;
          logger.warn("Failed to parse summary XML", { sessionId, attempt });
        }

        if (!response || !response.trim()) {
          const latencyMs = Date.now() - startMs;
          if (metricsStore) {
            await metricsStore.record("mem::summarize", latencyMs, false);
          }
          return { success: false, error: "empty_provider_response" };
        }

        if (!summary) {
          const latencyMs = Date.now() - startMs;
          if (metricsStore) {
            await metricsStore.record("mem::summarize", latencyMs, false);
          }
          return { success: false, error: "parse_failed" };
        }

        const summaryForValidation = {
          title: summary.title,
          narrative: summary.narrative,
          keyDecisions: summary.keyDecisions,
          filesModified: summary.filesModified,
          concepts: summary.concepts,

View on GitHub (pinned to e04ba88819)

Solutions

  1. Check provider API key, base URL, and model configuration; test with a direct API call.
  2. Retry later if the provider is rate-limiting or having an outage.
  3. Switch to a different provider/model via configuration.
  4. Review daemon logs to confirm the request was actually sent and what came back.

Example fix

// before
// provider: { baseUrl: "" } — empty responses
// after
// provider: { baseUrl: "https://api.provider.com/v1", apiKey: process.env.PROVIDER_API_KEY, model: "..." }
Defensive patterns

Strategy: fallback

Validate before calling

// validate provider config before calling summarize
if (!process.env.PROVIDER_API_KEY) throw new Error("missing provider API key");
const ping = await fetch(provider.baseUrl);

Type guard

function isEmptyProviderResponse(res: unknown): res is { success: false; error: "empty_provider_response" } {
  return typeof res === "object" && res !== null && (res as any).error === "empty_provider_response";
}

Try / catch

const res = await sdk.trigger({ function_id: "mem::summarize", payload: { sessionId } });
if (isEmptyProviderResponse(res)) {
  // fall back to a secondary provider or degrade to raw observations
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of rohitg00/agentmemory@e04ba88819 (2026-08-30). Data as JSON: /api/errors/c4f08492b1fc9bf8. Report an issue: GitHub.