{"record":{"id":"44d001e7efb435cf","repo":"mastra-ai/mastra","slug":"version-with-id-to-not-found-44d001","errorCode":null,"errorMessage":"Version with id ${to} 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":479,"sourceCode":"      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(\n        fromVersion as unknown as Record<string, unknown>,\n        SNAPSHOT_CONFIG_FIELDS,\n      );\n      const toConfig = extractConfigFromVersion(\n        toVersion as unknown as Record<string, unknown>,\n        SNAPSHOT_CONFIG_FIELDS,\n      );\n\n      const diffs = computeVersionDiffs(fromConfig, toConfig);\n","sourceCodeStart":461,"sourceCodeEnd":497,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/scorer-versions.ts#L461-L497","documentation":"This 404 is thrown by the scorer-versions copy-config handler when `scorerStore.getVersion(to)` returns nothing, i.e. the destination `to` version id does not exist. The handler resolves the source first, then the target, and aborts before any configuration is written.","triggerScenarios":"Calling the copy-config endpoint with a `to` version id that is not present in scorer storage (typo, deleted version, wrong environment).","commonSituations":"Targeting a version that was created after your client snapshot was taken... i.e. reversed: targeting a version that was deleted; hard-coding a `to` id from a different database; passing a draft/unsaved version id.","solutions":["List the scorer's versions and pick an existing id for `to`.","Confirm the request targets the environment whose storage holds that version.","Fix typos in the `to` version id.","Create the target version first, then retry the copy."],"exampleFix":"// before\nbody: JSON.stringify({ from: srcId, to: 'not-created-yet' })\n// after\nconst target = await createScorerVersion(scorerId, draftConfig);\nbody: JSON.stringify({ from: srcId, to: target.id })","handlingStrategy":"validation","validationCode":"const versions = await getScorerVersions(scorerId);\nif (!versions.some(v => v.id === toId)) throw new Error(`to version ${toId} 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(`Target version '${to}' not found — create it or pick an existing version.`);\n  } else throw e;\n}","preventionTips":["Create the destination version before copying configuration into it.","Refresh your version list after any create/delete operations.","Avoid hard-coded version ids in scripts; pass them as parameters resolved at runtime."],"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"}