{"record":{"id":"693a2cd5af484d6c","repo":"mastra-ai/mastra","slug":"version-with-id-versionid-not-found-693a2c","errorCode":null,"errorMessage":"Version with id ${versionId} not found","messagePattern":"Version with id (.+?) not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"packages/server/src/server/handlers/scorer-versions.ts","lineNumber":203,"sourceCode":"  description: 'Returns a specific version of a scorer by its version ID',\n  tags: ['Scorer Versions'],\n  handler: async ({ mastra, scorerId, versionId, 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 version = await scorerStore.getVersion(versionId);\n\n      if (!version) {\n        throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n      }\n\n      if (version.scorerDefinitionId !== scorerId) {\n        throw new HTTPException(404, {\n          message: `Version with id ${versionId} not found for scorer ${scorerId}`,\n        });\n      }\n      const scorer = await scorerStore.getById(scorerId);\n      assertStoredResourceScope(scorer, await getStoredResourceScope(mastra, requestContext));\n\n      return version;\n    } catch (error) {\n      return handleError(error, 'Error getting scorer version');\n    }\n  },\n});\n\n/**","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/scorer-versions.ts#L185-L221","documentation":"Thrown as HTTP 404 when getVersion(versionId) returns no row for the requested version id. Storage and store are healthy; the version identifier is unknown to this database.","triggerScenarios":"GET /api/scorers/{scorerId}/versions/{versionId} with a versionId that does not exist — fabricated id, id from another environment, or the version was pruned by retention limits (enforceRetentionLimit).","commonSituations":"Retaining stale version ids in a client after retention cleanup deleted old versions; ids copied across dev/staging databases; referencing versions before any version was created for the scorer.","solutions":["List the scorer's versions (GET /api/scorers/{scorerId}/versions) and use a valid versionId","Confirm client and server point at the same database/environment","Check whether a retention policy deleted the version; adjust retention or stop caching old ids","Fix the typo in the versionId"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const versions = await (await fetch(`/api/scorers/${scorerId}/versions`)).json();\nif (!versions.results?.some(v => v.id === versionId)) {\n  throw new Error(`Unknown versionId ${versionId} for scorer ${scorerId}`);\n}","typeGuard":"function versionExists(versionId: string, versions: { id: string }[]): boolean {\n  return versions.some(v => v.id === versionId);\n}","tryCatchPattern":"const res = await fetch(`/api/scorers/${scorerId}/versions/${versionId}`);\nif (res.status === 404) {\n  // list versions, pick a valid id or re-resolve from the scorer's activeVersionId\n}","preventionTips":["Fetch version ids from the list endpoint rather than persisting them long-term","Account for retention limits that may delete old versions","Keep environment-specific ids out of shared config","Check version.scorerDefinitionId match logic when iterating versions across scorers"],"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"}