{"record":{"id":"328797a4eb8837ca","repo":"mastra-ai/mastra","slug":"version-with-id-from-not-found-328797","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/prompt-block-versions.ts","lineNumber":460,"sourceCode":"  tags: ['Prompt Block Versions'],\n  handler: async ({ mastra, promptBlockId, 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 promptBlockStore = await storage.getStore('promptBlocks');\n      if (!promptBlockStore) {\n        throw new HTTPException(500, { message: 'Prompt blocks storage domain is not available' });\n      }\n      const promptBlock = await promptBlockStore.getById(promptBlockId);\n      assertStoredResourceScope(promptBlock, await getStoredResourceScope(mastra, requestContext));\n\n      const fromVersion = await promptBlockStore.getVersion(from);\n      if (!fromVersion) {\n        throw new HTTPException(404, { message: `Version with id ${from} not found` });\n      }\n      if (fromVersion.blockId !== promptBlockId) {\n        throw new HTTPException(404, {\n          message: `Version with id ${from} not found for prompt block ${promptBlockId}`,\n        });\n      }\n\n      const toVersion = await promptBlockStore.getVersion(to);\n      if (!toVersion) {\n        throw new HTTPException(404, { message: `Version with id ${to} not found` });\n      }\n      if (toVersion.blockId !== promptBlockId) {\n        throw new HTTPException(404, {\n          message: `Version with id ${to} not found for prompt block ${promptBlockId}`,\n        });\n      }\n\n      const fromConfig = extractConfigFromVersion(","sourceCodeStart":442,"sourceCodeEnd":478,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/prompt-block-versions.ts#L442-L478","documentation":"Thrown by the revert/compare handler when getVersion(from) returns null: the 'from' version id supplied in the request does not exist. 404 HTTPException; scope checks on the block have already passed, so only the version id is wrong.","triggerScenarios":"Requesting a version diff/revert with a from versionId that was deleted or never existed under this storage.","commonSituations":"Reverting to an old version that a teammate already pruned, stale UI state listing versions, or ids copied from logs of another environment.","solutions":["Re-fetch the block's version list and use an existing versionId as 'from'.","Check the version wasn't deleted by the delete-version route or cleanup jobs.","Confirm both client and server point at the same storage database."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const versions = await getBlockVersions(promptBlockId);\nif (!versions.some(v => v.id === from)) {\n  throw new Error(`'from' version ${from} not found on block ${promptBlockId}`);\n}","typeGuard":"function resolveFrom(versions: { id: string }[], from: string): string | null {\n  return versions.some(v => v.id === from) ? from : null;\n}","tryCatchPattern":"try {\n  await revertVersions(promptBlockId, from, to);\n} catch (e) {\n  if (e.status === 404 && e.message.includes('with id ' + from)) {\n    // refetch version list and pick an existing 'from'\n  }\n  throw e;\n}","preventionTips":["Refresh the version list before any diff/revert call.","Prune stale version ids from persisted UI state.","Confirm environment/database alignment between client and server."],"tags":["http-404","rest-api","versions","not-found"],"backgroundTag":"resource-not-found-404","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}