Budibase/budibase · warning · HTTPError

Agent log detail not found

Error message

Agent log detail not found

What it means

fetchLiteLLMRequestRaw combines the payload and summary for a request id and throws HTTPError 404 'Agent log detail not found' when LiteLLM has no payload for that id (payload fetch returned null). This distinguishes 'log does not exist' from upstream HTTP failures, which are thrown separately by the sub-fetches.

Source

Thrown at packages/server/src/sdk/workspace/ai/agentLogs/liteLLM.ts:166

    throw new Error(
      `Error fetching agent log detail: ${text || response.statusText}`
    )
  }

  return (await response.json()) as LiteLLMRequestPayload
}

export async function fetchLiteLLMRequestRaw(
  agentId: string,
  requestId: string
): Promise<LiteLLMRequestDetail> {
  const [payload, summary] = await Promise.all([
    fetchLiteLLMRequestPayloadById(requestId),
    fetchLiteLLMRequestSummaryById(requestId),
  ])

  if (!payload) {
    throw new HTTPError("Agent log detail not found", 404)
  }
  const data: LiteLLMRequestDetail = {
    request_id: requestId,
    model: summary?.model,
    prompt_tokens: summary?.prompt_tokens,
    completion_tokens: summary?.completion_tokens,
    spend: summary?.spend,
    status: summary?.status,
    startTime: summary?.startTime,
    endTime: summary?.endTime,
    end_user: summary?.end_user,
    user: summary?.user,
    metadata: summary?.metadata,
    response: payload.response,
    proxy_server_request: payload.proxy_server_request,
  }

  validateLiteLLMRequestOwnership(agentId, data)

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Verify the requestId exists in LiteLLM directly: GET $AGENT_LITELLM_URL/requests/{id} with the master key
  2. Confirm you are pointed at the same LiteLLM instance/environment that produced the log
  3. Check LiteLLM log retention/cleanup settings if the log previously existed
  4. Handle the 404 in the UI as 'log no longer available' rather than retrying

Example fix

// before
if (!payload) {
  throw new HTTPError("Agent log detail not found", 404)
}
// after
if (!payload) {
  throw new HTTPError(`Agent log detail not found for request_id ${requestId}`, 404)
}
Defensive patterns

Strategy: fallback

Type guard

function isAgentLogDetail(v: unknown): v is LiteLLMRequestDetail {
  return typeof v === "object" && v !== null && "request_id" in v
}

Try / catch

try {
  const detail = await fetchLiteLLMRequestRaw(requestId)
  return detail
} catch (err) {
  if (err instanceof HTTPError && err.status === 404) {
    return null // log pruned or wrong environment
  }
  throw err
}

Prevention

When it happens

Trigger: GET on an agent log detail endpoint with a requestId that was never logged by LiteLLM, a request older than LiteLLM's log retention window, a request id from a different LiteLLM instance/environment, or a malformed/truncated id that LiteLLM answers with 404.

Common situations: Developer copies a request_id from a different app/environment; LiteLLM pruned old spend logs; UI bookmarked a log that has since been deleted; typo'd id passed in the URL.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/c5e491a8e7250203. Report an issue: GitHub.