{"record":{"id":"1393c5b470ce36fe","repo":"mastra-ai/mastra","slug":"stored-scorer-definition-with-id-storedscorerid","errorCode":null,"errorMessage":"Stored scorer definition with id ${storedScorerId} not found","messagePattern":"Stored scorer definition with id (.+?) not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"packages/server/src/server/handlers/stored-scorers.ts","lineNumber":110,"sourceCode":"  tags: ['Stored Scorers'],\n  requiresAuth: true,\n  handler: async ({ mastra, storedScorerId, status, requestContext }) => {\n    try {\n      const storage = mastra.getStorage();\n\n      if (!storage) {\n        throw new HTTPException(500, { message: 'Storage is not configured' });\n      }\n\n      const scorerStore = await storage.getStore('scorerDefinitions');\n      if (!scorerStore) {\n        throw new HTTPException(500, { message: 'Scorer definitions storage domain is not available' });\n      }\n\n      const scorer = await scorerStore.getByIdResolved(storedScorerId, { status });\n\n      if (!scorer) {\n        throw new HTTPException(404, { message: `Stored scorer definition with id ${storedScorerId} not found` });\n      }\n      assertStoredResourceScope(scorer, await getStoredResourceScope(mastra, requestContext));\n\n      return scorer;\n    } catch (error) {\n      return handleError(error, 'Error getting stored scorer definition');\n    }\n  },\n});\n\n/**\n * POST /stored/scorers - Create a new stored scorer definition\n */\nexport const CREATE_STORED_SCORER_ROUTE = createRoute({\n  method: 'POST',\n  path: '/stored/scorers',\n  responseType: 'json',\n  bodySchema: createStoredScorerBodySchema,","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/stored-scorers.ts#L92-L128","documentation":"Raised by the get-stored-scorer handler when `scorerStore.getByIdResolved(storedScorerId, { status })` returns null — no scorer definition exists for that id (optionally at the requested draft/published `status`). Returned to the client as HTTP 404.","triggerScenarios":"GET stored scorer with an id never registered; requesting `status=published` for a scorer that only exists as a draft; id from a different database/environment; typo'd slug.","commonSituations":"Frontend linking to a scorer that was deleted; querying the published variant before the scorer was ever published; CI tests using fixture ids against an empty database.","solutions":["List stored scorers to confirm the exact id and drop the `status` query param (or use `draft`) if the scorer is unpublished.","Publish the scorer definition if you specifically need the published version.","Confirm the server points at the storage environment where the scorer was created.","Handle 404 client-side by showing 'scorer not found' instead of retrying."],"exampleFix":"// before\ngetScorer('my-scorer', { status: 'published' }); // 404: only a draft exists\n\n// after\ngetScorer('my-scorer'); // or publish it first","handlingStrategy":"try-catch","validationCode":"const all = await listStoredScorers();\nif (!all.results.some(s => s.id === id)) console.warn(`Scorer ${id} not present; statuses available:`, all.results.map(s => ({ id: s.id })));","typeGuard":"function scorerExists(list: { id: string }[], id: string) { return list.find(s => s.id === id); }","tryCatchPattern":"try {\n  return await getStoredScorer(id, { status: 'published' });\n} catch (e) {\n  if (e.status === 404) return null; // render 'not found' UI\n  throw e;\n}","preventionTips":["Omit the status filter unless you know the scorer was published","Refresh cached scorer lists before deep-linking to an id","Seed fixture scorers in CI before tests that fetch by id"],"tags":["http-404","storage","not-found","rest-api"],"backgroundTag":"resource-not-found-404","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}