{"record":{"id":"6c0ac57c4c16ddb3","repo":"mastra-ai/mastra","slug":"memory-storage-is-not-configured-for-agent-agen","errorCode":null,"errorMessage":"Memory storage is not configured for agent \"${agent.id}\"","messagePattern":"Memory storage is not configured for agent \"(.+?)\"","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"packages/server/src/server/handlers/conversations.ts","lineNumber":68,"sourceCode":"  responseSchema: conversationObjectSchema,\n  summary: 'Create a conversation',\n  description: 'Creates a new thread-backed conversation for agent-backed Responses API requests',\n  tags: ['Responses'],\n  requiresAuth: true,\n  requiresPermission: MastraFGAPermissions.AGENTS_CREATE,\n  handler: async ({ mastra, requestContext, agent_id, conversation_id, resource_id, title, metadata }) => {\n    try {\n      if (!mastra) {\n        throw new HTTPException(500, { message: 'Mastra instance is required for conversations' });\n      }\n\n      const agent = await getAgentFromSystem({ mastra, agentId: agent_id });\n      const memory = await agent.getMemory({ requestContext });\n      if (!memory) {\n        throw new HTTPException(400, { message: `Agent \"${agent.id}\" does not have memory configured` });\n      }\n      if (!(await getAgentMemoryStore({ agent, requestContext }))) {\n        throw new HTTPException(400, { message: `Memory storage is not configured for agent \"${agent.id}\"` });\n      }\n\n      const threadId = conversation_id ?? randomUUID();\n      const resourceId = getEffectiveResourceId(requestContext, resource_id) ?? threadId;\n      const thread = await memory.createThread({\n        threadId,\n        resourceId,\n        title,\n        metadata,\n      });\n\n      return buildConversationObject({ thread });\n    } catch (error) {\n      return handleError(error, 'Error creating conversation');\n    }\n  },\n});\n","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/conversations.ts#L50-L86","documentation":"Beyond having a Memory instance, the agent's memory must have a storage backend for conversations to persist threads and messages. The handler calls getAgentMemoryStore and throws HTTP 400 when the memory's storage is not configured.","triggerScenarios":"POSTing to create-conversation for an agent whose Memory was constructed without a `storage` option (in-memory only or none), so getAgentMemoryStore resolves to undefined.","commonSituations":"Memory created only with options (working memory/lastMessages) but no storage in dev setups; storage intentionally omitted for tests then the agent is used with the conversations API; switching deployments and forgetting to wire storage (e.g. LibSQL/Postgres/Upstash) into Memory.","solutions":["Construct Memory with a storage backend: new Memory({ storage: new LibSQLStore({ url: ... }) }) or your preferred storage adapter","Verify the storage adapter is correctly instantiated and its connection (DB URL/token) is valid","Share one storage instance across agents if conversations should be portable, and confirm it is the one wired into the agent","Check env vars for the storage connection are present at server start"],"exampleFix":"// before\nmemory: new Memory({ options: { lastMessages: 10 } })\n// after\nmemory: new Memory({ storage: new LibSQLStore({ url: process.env.DATABASE_URL }), options: { lastMessages: 10 } })","handlingStrategy":"validation","validationCode":"const memory = await agent.getMemory();\nif (!memory) throw new Error('No memory configured');\nif (!memory.constructor.name.includes('Memory')) throw new Error('Unexpected memory type');\n// storage is required for conversations:\nconst mem = new Memory({ storage: resolveStorageFromEnv() }); // ensure storage present at construction","typeGuard":"function memoryHasStorage(m: Memory | undefined): boolean {\n  return !!m && 'storage' in m && m.storage != null;\n}","tryCatchPattern":"try {\n  const conv = await client.createConversation({ agent_id });\n} catch (e) {\n  if (e.status === 400 && /storage is not configured/.test(e.message)) {\n    console.error('Wire a storage adapter into Memory for this agent');\n  }\n  throw e;\n}","preventionTips":["Always pass storage when constructing Memory for conversation-backed agents","Share a single configured storage instance across agents","Assert storage presence in an environment/config startup check","Keep storage credentials in env and validate at boot"],"tags":["memory","storage","http-400","agent-configuration"],"backgroundTag":"memory-storage-not-configured","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}