mastra-ai/mastra · error · HTTPException
Stored responses require the target agent to have memory con
Error message
Stored responses require the target agent to have memory configured
What it means
The responses route rejects a request with store:true when the target agent has no memory configured, so no threadContext could be established to persist the response turn. The server returns HTTP 400 because storing responses requires a memory-backed thread.
Source
Thrown at packages/server/src/server/handlers/responses.ts:745
: 'conversation_id requires the target agent to have memory storage configured',
})
: null;
const configuredTools = mapMastraToolsToResponseTools(
(await Promise.resolve(agent.listTools({ requestContext }))) as Record<string, unknown>,
);
const responseId = createMessageId();
const createdAt = Math.floor(Date.now() / 1000);
const threadContext = await resolveThreadExecutionContext({
agent,
store: shouldStore,
conversationId: body.conversation_id,
previousResponseTurnRecord,
requestContext,
});
if (shouldStore && !threadContext) {
throw new HTTPException(400, {
message: 'Stored responses require the target agent to have memory configured',
});
}
const didStore = shouldStore && Boolean(threadContext);
return {
agent,
agentMemoryStore,
configuredTools,
createdAt,
didStore,
executionInput,
previousResponseTurnRecord,
resolvedModel,
responseId,
responseModel,
responseMetadata: {View on GitHub (pinned to 75dd419e61)
Solutions
- Attach a Memory instance (backed by storage) to the agent, then retry.
- If persistence is not needed, explicitly send store:false and omit conversation_id/previous_response_id.
- Verify the memory/storage package is installed and passed to the Agent constructor.
Example fix
// before
new Agent({ name: 'a', instructions: 'i', model: 'openai/gpt-4o' })
// after
new Agent({ name: 'a', instructions: 'i', model: 'openai/gpt-4o', memory: new Memory({ storage: new LibSQLStore({ url: 'file:./mastra.db' }) }) }) Defensive patterns
Strategy: validation
Validate before calling
// only request storage if the agent has memory
if ((body.store || body.conversation_id || body.previous_response_id) && !agentHasMemory(agentId)) {
// either attach memory server-side or strip persistence fields
body = { ...body, store: false, conversation_id: undefined, previous_response_id: undefined };
} Type guard
function canStore(agent: Agent): boolean {
return Boolean((agent as { memory?: unknown }).memory);
} Try / catch
try {
return await client.createResponse(body);
} catch (e) {
if (isHttpError(e, 400) && /memory configured/.test(e.message)) {
return client.createResponse({ ...body, store: false });
}
throw e;
} Prevention
- Give every agent that needs conversation history a Memory instance with storage.
- Send store:false explicitly when persistence is unwanted (don't rely on defaults).
- Keep a registry of which agents have memory before enabling store.
When it happens
Trigger: POST to the responses route with body.store=true (or body.conversation_id / body.previous_response_id implying persistence) against an agent created without a Memory instance.
Common situations: Following the OpenAI responses API convention (store defaults true there) but the Mastra agent was built without memory; new Agent({ memory: undefined }) in a minimal agent; copying example code that assumes memory is wired.
Related errors
- Observational Memory is not enabled for this agent
- Memory is not configured for this agent
- sendStateSignal requires Mastra memory
- Storage is not configured on this AgentController
- Storage does not have a memory domain configured
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/93d663f538f1c66f.
Report an issue: GitHub.