{"record":{"id":"8fef0af4361706bf","repo":"mastra-ai/mastra","slug":"version-with-id-from-not-found-8fef0a","errorCode":null,"errorMessage":"Version with id ${from} 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":469,"sourceCode":"  tags: ['Scorer Versions'],\n  handler: async ({ mastra, scorerId, from, to, 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      const scorer = await scorerStore.getById(scorerId);\n      assertStoredResourceScope(scorer, await getStoredResourceScope(mastra, requestContext));\n\n      const fromVersion = await scorerStore.getVersion(from);\n      if (!fromVersion) {\n        throw new HTTPException(404, { message: `Version with id ${from} not found` });\n      }\n      if (fromVersion.scorerDefinitionId !== scorerId) {\n        throw new HTTPException(404, {\n          message: `Version with id ${from} not found for scorer ${scorerId}`,\n        });\n      }\n\n      const toVersion = await scorerStore.getVersion(to);\n      if (!toVersion) {\n        throw new HTTPException(404, { message: `Version with id ${to} not found` });\n      }\n      if (toVersion.scorerDefinitionId !== scorerId) {\n        throw new HTTPException(404, {\n          message: `Version with id ${to} not found for scorer ${scorerId}`,\n        });\n      }\n\n      const fromConfig = extractConfigFromVersion(","sourceCodeStart":451,"sourceCodeEnd":487,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/scorer-versions.ts#L451-L487","documentation":"This 404 is thrown by the scorer-versions copy-configuration handler when `scorerStore.getVersion(from)` returns no version for the `from` version id supplied in the request. The server validates that both source and target versions exist before copying configuration between scorer versions. It means the referenced version id does not exist in the scorer storage.","triggerScenarios":"Calling the scorer version config-copy endpoint with a `from` version id that was never created, was deleted, or belongs to another Mastra instance/storage backend.","commonSituations":"Copy-pasting a stale version id from logs or an old database; switching environments (dev vs prod storage) where version ids differ; typos in the version UUID; using a version id from a deleted scorer definition.","solutions":["List the scorer's versions via the scorers API/storage to confirm the correct `from` version id exists.","Check that you are connected to the storage backend (database) that actually contains the version.","Correct the `from` id in your request payload or URL.","If the version was deleted, recreate it or pick an existing version as the source."],"exampleFix":"// before\nawait fetch(`/api/scorers/${scorerId}/versions/copy`, { method: 'POST', body: JSON.stringify({ from: 'stale-version-id', to: currentVersionId }) });\n// after\nconst versions = await fetch(`/api/scorers/${scorerId}/versions`).then(r => r.json());\nconst from = versions[0].id; // use a version id that actually exists\nawait fetch(`/api/scorers/${scorerId}/versions/copy`, { method: 'POST', body: JSON.stringify({ from, to: currentVersionId }) });","handlingStrategy":"validation","validationCode":"const versions = await fetch(`/api/scorers/${scorerId}/versions`).then(r => r.json());\nif (!versions.some(v => v.id === fromId)) throw new Error(`from version ${fromId} does not exist for ${scorerId}`);","typeGuard":null,"tryCatchPattern":"try {\n  await copyScorerVersionConfig({ scorerId, from, to });\n} catch (e) {\n  if (e instanceof MastraClientError && e.status === 404) {\n    console.error(`Version '${from}' not found; fetch valid versions and retry with an existing id.`);\n  } else throw e;\n}","preventionTips":["Always resolve version ids dynamically from the versions list endpoint rather than hard-coding them.","Keep per-environment version ids in config, not shared constants.","Log the scorerId alongside version ids to avoid cross-scorer mixups."],"tags":["http-404","scorer-versions","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"}