{"record":{"id":"6679154b0788936c","repo":"mastra-ai/mastra","slug":"stored-response-responseid-was-not-found","errorCode":null,"errorMessage":"Stored response ${responseId} was not found","messagePattern":"Stored response (.+?) was not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"packages/server/src/server/handlers/responses.ts","lineNumber":1029,"sourceCode":"  },\n});\n\nexport const GET_RESPONSE_ROUTE = createRoute({\n  method: 'GET',\n  path: '/v1/responses/:responseId',\n  responseType: 'json',\n  pathParamSchema: responseIdPathParams,\n  responseSchema: responseObjectSchema,\n  summary: 'Retrieve a stored response',\n  description: 'Returns a previously stored response object',\n  tags: ['Responses'],\n  requiresAuth: true,\n  requiresPermission: MastraFGAPermissions.AGENTS_READ,\n  handler: async ({ mastra, requestContext, responseId }) => {\n    try {\n      const responseTurnRecord = await findResponseTurnRecordAcrossAgents({ mastra, responseId, requestContext });\n      if (!responseTurnRecord) {\n        throw new HTTPException(404, { message: `Stored response ${responseId} was not found` });\n      }\n\n      return mapResponseTurnRecordToResponse(responseTurnRecord);\n    } catch (error) {\n      return handleError(error, 'Error retrieving response');\n    }\n  },\n});\n\nexport const DELETE_RESPONSE_ROUTE = createRoute({\n  method: 'DELETE',\n  path: '/v1/responses/:responseId',\n  responseType: 'json',\n  pathParamSchema: responseIdPathParams,\n  responseSchema: deleteResponseSchema,\n  summary: 'Delete a stored response',\n  description: 'Deletes a stored response so it can no longer be retrieved or chained',\n  tags: ['Responses'],","sourceCodeStart":1011,"sourceCodeEnd":1047,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/responses.ts#L1011-L1047","documentation":"GET response-by-id handler: findResponseTurnRecordAcrossAgents searches all agents' memory for the given responseId; if no stored turn record matches, the handler throws HTTP 404. It is then caught by handleError and surfaced as 'Error retrieving response'.","triggerScenarios":"GET /api/responses/:responseId (AGENTS_READ) with an id that was never stored, was deleted, or lives in a different storage backend/instance.","commonSituations":"Client cached a response id after the DB was reset; retrieving across environments (staging vs local dev DB); requesting ids from responses created with store:false; retention cleanup removed the record.","solutions":["Confirm the response was originally created with store:true so a turn record exists.","Point the server at the same storage backend the response was written to.","List/re-check recent stored responses to validate the id; regenerate if the record is gone.","Return 404 handling on the client side and start a new conversation."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-check existence before fetching\nconst list = await client.getResponses?.({ threadId }) ?? [];\nif (!list.some(r => r.id === responseId)) return null;","typeGuard":null,"tryCatchPattern":"try {\n  return await client.getResponse(responseId);\n} catch (e) {\n  if (isHttpError(e, 404)) return null; // treat as absent, not fatal\n  throw e;\n}","preventionTips":["Only fetch ids returned from stored (store:true) responses.","Point clients at the environment whose storage holds the record.","Handle 404 gracefully as 'expired/pruned' in UI code."],"tags":["http-404","responses-api","server"],"backgroundTag":"stored-response-not-found","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}