Budibase/budibase · error · Error
Invalid agent request link response: unknown requestId "${de
Error message
Invalid agent request link response: unknown requestId "${decision.requestId}" What it means
After parsing the LLM link decision, analyzeAgentRequestLink verifies that a decision of "existing_thread" references a requestId actually present in candidateRequests. If the model hallucinates or returns a requestId not among the candidates, it throws Error(`Invalid agent request link response: unknown requestId "${decision.requestId}"`).
Source
Thrown at packages/server/src/sdk/workspace/ai/agentRequests/helpers.ts:140
} catch (error) {
console.error("Failed to analyze agent request link", {
agentId,
sessionId,
error,
})
throw error
}
const decision = extractJson(result.text || "")
if (!decision) {
throw new Error("Invalid agent request link response")
}
if (
decision.decision === "existing_thread" &&
!candidateRequests.some(request => request._id === decision.requestId)
) {
throw new Error(
`Invalid agent request link response: unknown requestId "${decision.requestId}"`
)
}
return {
decision: decision.decision,
requestId: decision.requestId,
entryAction: decision.entryAction,
}
}
export async function generateAgentRequestTitle({
latestPrompt,
agentId,
sessionId,
operation,
}: {
latestPrompt: stringView on GitHub (pinned to a81a902e9a)
Solutions
- Catch the error and fall back to decision "new_thread"
- Retry the analysis call; if it recurs, disable request linking for the model config
- Use a stronger model that respects the candidate list, or include only clearly-labeled candidate IDs in the prompt
Example fix
// before
const analysis = await analyzeAgentRequestLink({ candidateRequests, ... })
// after
let analysis
try {
analysis = await analyzeAgentRequestLink({ candidateRequests, ... })
} catch {
analysis = { decision: "new_thread" }
} Defensive patterns
Strategy: fallback
Try / catch
let analysis
try {
analysis = await analyzeAgentRequestLink({ latestPrompt, candidateRequests, ... })
} catch (err) {
if (err instanceof Error && err.message.includes("unknown requestId")) {
analysis = { decision: "new_thread" }
} else {
throw err
}
} Prevention
- Explicitly label candidate requestIds in the prompt and instruct the model to choose only from them
- Use stronger models less prone to hallucinating IDs
- Treat unknown requestId as new_thread instead of failing the user request
When it happens
Trigger: The LLM returns {"decision":"existing_thread","requestId":"..."} where the ID is fabricated, from another session, truncated, or not in the candidate list passed to the function.
Common situations: Hallucinated IDs from smaller models; candidates filtered down between analysis and validation; the model echoing an ID from recentChatContext instead of candidateRequests.
Related errors
- Invalid agent request link response
- Invalid agent request title response
- Invalid tool call summary response
- Error generating tables
- LLM not available
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/8483325b27de76a8.
Report an issue: GitHub.