Budibase/budibase · warning · HTTPError
Agent log detail not found
Error message
Agent log detail not found
What it means
validateLiteLLMRequestOwnership enforces that a fetched LiteLLM request detail actually belongs to the given agent by comparing the request's end user (proxy_server_request.user / end_user / user) with the expected `bb-agent:<agentId>` value. On mismatch it throws HTTPError("Agent log detail not found", 404) — deliberately a 404, not 403, to avoid leaking the existence of other agents' log entries.
Source
Thrown at packages/server/src/sdk/workspace/ai/agentLogs/shared.ts:314
throw new HTTPError("Invalid environment query", 400)
}
export function getLiteLLMRequestUser(
data: LiteLLMRequestDetail | AgentLogSessionIndexDoc
): string | undefined {
if ("proxy_server_request" in data || "end_user" in data || "user" in data) {
return data.proxy_server_request?.user || data.end_user || data.user
}
return undefined
}
export function validateLiteLLMRequestOwnership(
agentId: string,
data: LiteLLMRequestDetail
) {
if (getLiteLLMRequestUser(data) !== getExpectedEndUser(agentId)) {
throw new HTTPError("Agent log detail not found", 404)
}
}
View on GitHub (pinned to a81a902e9a)
Solutions
- Verify the agentId in the request path matches the agent that made the LiteLLM call
- Ensure LiteLLM requests are tagged with the bb-agent:<agentId> end user when sent
- Confirm the request detail source (LiteLLM proxy) actually stores the user metadata; check getLiteLLMRequestUser extraction
- Catch the 404 and show a not-found view rather than retrying with the same IDs
Example fix
// before
const detail = await fetchLiteLLMRequestRaw(requestId)
validateLiteLLMRequestOwnership(agentId, detail) // 404 if agent mismatch
// after
const expected = `bb-agent:${agentId}`
const user = detail.proxy_server_request?.user || detail.end_user || detail.user
if (user !== expected) {
throw new HTTPError("Agent log detail not found", 404)
} Defensive patterns
Strategy: try-catch
Type guard
function isOwnedByAgent(agentId: string, data: LiteLLMRequestDetail): boolean {
const user = data.proxy_server_request?.user || data.end_user || data.user
return user === `bb-agent:${agentId}`
} Try / catch
try {
validateLiteLLMRequestOwnership(agentId, detail)
} catch (err) {
if (err instanceof HTTPError && err.status === 404) {
// render not-found: the request belongs to another agent or lacks user metadata
}
} Prevention
- Always tag LiteLLM calls with end user bb-agent:<agentId>
- Confirm agentId in the route matches the agent whose logs you are viewing
- Check LiteLLM version/proxy config stores proxy_server_request.user metadata
When it happens
Trigger: Looking up a LiteLLM request detail whose user field does not equal `bb-agent:<agentId>` — e.g. querying another agent's request ID, a request with no end-user metadata, or a stale/mismatched agentId.
Common situations: A UI passes the wrong agentId in the route while showing another agent's log entry; LiteLLM records lack end_user tagging (older LiteLLM version or missing litellm user config); cross-workspace access attempts.
Related errors
- Agent log detail not found
- Error getting account by tenantId ${tenantId}
- Tool is not available in this security context
- Slack OAuth authorization failed
- Operation not found for this agent
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/18bfabb835f2601e.
Report an issue: GitHub.