{"record":{"id":"54d0ad11cea3a207","repo":"mastra-ai/mastra","slug":"conversation-conversationid-was-not-found","errorCode":null,"errorMessage":"Conversation ${conversationId} was not found","messagePattern":"Conversation (.+?) was not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"packages/server/src/server/handlers/conversations.ts","lineNumber":102,"sourceCode":"  },\n});\n\nexport const GET_CONVERSATION_ROUTE = createRoute({\n  method: 'GET',\n  path: '/v1/conversations/:conversationId',\n  responseType: 'json',\n  pathParamSchema: conversationIdPathParams,\n  responseSchema: conversationObjectSchema,\n  summary: 'Retrieve a conversation',\n  description: 'Returns a conversation object backed by a Mastra memory thread',\n  tags: ['Responses'],\n  requiresAuth: true,\n  requiresPermission: MastraFGAPermissions.AGENTS_READ,\n  handler: async ({ mastra, requestContext, conversationId }) => {\n    try {\n      const match = await findConversationThreadAcrossAgents({ mastra, conversationId, requestContext });\n      if (!match) {\n        throw new HTTPException(404, { message: `Conversation ${conversationId} was not found` });\n      }\n\n      return buildConversationObject({ thread: match.thread });\n    } catch (error) {\n      return handleError(error, 'Error retrieving conversation');\n    }\n  },\n});\n\nexport const GET_CONVERSATION_ITEMS_ROUTE = createRoute({\n  method: 'GET',\n  path: '/v1/conversations/:conversationId/items',\n  responseType: 'json',\n  pathParamSchema: conversationIdPathParams,\n  responseSchema: conversationItemsListSchema,\n  summary: 'List conversation items',\n  description: 'Returns OpenAI-style conversation items derived from the stored thread messages',\n  tags: ['Responses'],","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/conversations.ts#L84-L120","documentation":"The get-conversation handler searches all agents' memory stores for a thread matching conversationId via findConversationThreadAcrossAgents and throws HTTP 404 when no thread is found. The conversation ID either never existed or is not in any storage reachable by the configured agents.","triggerScenarios":"GETting /api/conversations/:conversationId where no agent's memory store contains a thread with that ID — deleted thread, wrong ID, storage backend changed, or the agent with that thread isn't registered on this server.","commonSituations":"Hard-coding a conversation ID from a different environment/database; switching storage adapters between dev and prod so old thread IDs don't resolve; thread deleted by a concurrent user; typos in the ID; server pointing at a fresh database.","solutions":["Verify the conversation ID exists by listing conversations (GET conversations for the agent) and using a returned ID","Confirm the server's memory storage points at the same database that contains the thread","Check the agent that owned the conversation is registered on this Mastra instance","If the thread was deleted, create a new conversation instead of expecting recovery"],"exampleFix":"// before\nawait client.getConversation('hardcoded-thread-id');\n// after\nconst convs = await client.listConversations({ agentId: 'agent-1' });\nconst conv = await client.getConversation(convs.conversations[0].id);","handlingStrategy":"validation","validationCode":"const convs = await client.listConversations({ agentId });\nconst target = convs.conversations.find(c => c.id === conversationId);\nif (!target) throw new Error(`Conversation ${conversationId} not found in ${agentId}`);","typeGuard":null,"tryCatchPattern":"try {\n  const conv = await client.getConversation(conversationId);\n} catch (e) {\n  if (e.status === 404) {\n    // re-fetch conversation list or surface 'conversation not found' to user\n  }\n  throw e;\n}","preventionTips":["Never hard-code conversation IDs across environments","List conversations before fetching a specific one","Keep storage backends consistent between environments that share IDs","Treat conversation IDs as ephemeral and refetch on 404"],"tags":["http-404","conversations","not-found","server-api"],"backgroundTag":"resource-not-found","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}