{"record":{"id":"d7707c3d9d7311de","repo":"mastra-ai/mastra","slug":"version-with-id-to-not-found-for-scorer-score","errorCode":null,"errorMessage":"Version with id ${to} not found for scorer ${scorerId}","messagePattern":"Version with id (.+?) not found for scorer (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"packages/server/src/server/handlers/scorer-versions.ts","lineNumber":482,"sourceCode":"      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\n      return {\n        diffs,\n        fromVersion,","sourceCodeStart":464,"sourceCodeEnd":500,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/scorer-versions.ts#L464-L500","documentation":"Thrown when the `to` version exists but belongs to a different scorer definition than the `scorerId` in the request path. Like the `from` counterpart, it returns 404 to avoid cross-scorer version disclosure. No configuration is copied in this case.","triggerScenarios":"Calling copy-config with a `to` version id owned by another scorer while the path names a different scorerId.","commonSituations":"Swapping from/to ids between two scorers; reusing a payload template that references versions of a different scorer; multi-tenant setups where ids collide across tenants' storages.","solutions":["Use a `to` version id that belongs to the scorer named in the URL.","List versions for the target scorer and copy an id from that list.","If the target scorer is different, update the scorerId path parameter to match the version's owner."],"exampleFix":"// before\nawait copyConfig({ scorerId: 'scorer-a', from: aFrom, to: scorerBVersionId });\n// after\nconst versionsA = await getScorerVersions('scorer-a');\nawait copyConfig({ scorerId: 'scorer-a', from: aFrom, to: versionsA[versionsA.length - 1].id });","handlingStrategy":"validation","validationCode":"const versions = await getScorerVersions(scorerId);\nif (!versions.some(v => v.id === toId)) throw new Error(`version ${toId} does not belong to scorer ${scorerId}`);","typeGuard":null,"tryCatchPattern":"try {\n  await copyScorerVersionConfig({ scorerId, from, to });\n} catch (e) {\n  if (e instanceof MastraClientError && e.status === 404 && /for scorer/.test(e.message)) {\n    console.error(`'to' version ${to} belongs to a different scorer — select a target owned by ${scorerId}.`);\n  } else throw e;\n}","preventionTips":["Source and target versions must come from the same scorer's version list.","Validate both from and to against the same fetched version set before calling the API.","Double-check request payloads assembled from templates for cross-scorer ids."],"tags":["http-404","scorer-versions","ownership-mismatch"],"backgroundTag":"resource-not-found-404","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}