{"record":{"id":"d87ef2dc0ee984af","repo":"mastra-ai/mastra","slug":"scorer-with-id-scorerid-not-found","errorCode":null,"errorMessage":"Scorer with id ${scorerId} not found","messagePattern":"Scorer with id (.+?) not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"packages/server/src/server/handlers/scorer-versions.ts","lineNumber":69,"sourceCode":"  summary: 'List scorer versions',\n  description: 'Returns a paginated list of all versions for a stored scorer',\n  tags: ['Scorer Versions'],\n  handler: async ({ mastra, scorerId, page, perPage, orderBy, 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.getById(scorerId);\n      if (!scorer) {\n        throw new HTTPException(404, { message: `Scorer with id ${scorerId} not found` });\n      }\n      assertStoredResourceScope(scorer, await getStoredResourceScope(mastra, requestContext));\n\n      const result = await scorerStore.listVersions({\n        scorerDefinitionId: scorerId,\n        page,\n        perPage,\n        orderBy,\n      });\n\n      return result;\n    } catch (error) {\n      return handleError(error, 'Error listing scorer versions');\n    }\n  },\n});\n\n/**","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/scorer-versions.ts#L51-L87","documentation":"Thrown as HTTP 404 when scorerStore.getById(scorerId) finds no scorer definition matching the given id. The library raises it after storage is confirmed working, meaning the identifier itself is wrong or the record does not exist in this deployment's storage.","triggerScenarios":"GET /api/scorers/{scorerId}/versions with a scorerId that is not present in the scorer_definitions table — typo'd id, id from another environment/database, or the scorer was deleted.","commonSituations":"Hardcoding a scorer id copied from local dev into staging; referencing a scorer that exists only in code (registered in Mastra) but was never persisted/registered in the version store; after truncating/migrating the database.","solutions":["Verify the scorerId by listing scorers (GET /api/scorers) and using an id from the response","Confirm the server is pointed at the database/environment where the scorer actually exists","Re-register or recreate the scorer if it was deleted","Fix the id typo in the calling client/config"],"exampleFix":"// before\nawait fetch(`/api/scorers/scorer_prod_v1/versions`);\n// after — resolve the real id first\nconst scorers = await (await fetch('/api/scorers')).json();\nconst id = scorers.find(s => s.name === 'my-scorer').id;\nawait fetch(`/api/scorers/${id}/versions`);","handlingStrategy":"try-catch","validationCode":"const scorers = await (await fetch('/api/scorers')).json();\nconst exists = scorers.some(s => s.id === scorerId);\nif (!exists) throw new Error(`Unknown scorerId: ${scorerId}`);","typeGuard":"function isKnownScorer(scorerId: string, known: { id: string }[]): boolean {\n  return known.some(s => s.id === scorerId);\n}","tryCatchPattern":"const res = await fetch(`/api/scorers/${scorerId}/versions`);\nif (res.status === 404) {\n  // resolve correct scorerId via list endpoint before retrying\n}","preventionTips":["Resolve scorer ids dynamically via the list endpoint instead of hardcoding","Tag ids with their environment (dev/stage/prod) to avoid cross-env copy/paste","Re-seed scorer definitions when databases are recreated","Log the resolved scorerId with requests to ease 404 triage"],"tags":["http-404","storage","server"],"backgroundTag":"resource-not-found","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}