{"record":{"id":"102c100ea4030dbc","repo":"mastra-ai/mastra","slug":"stored-workspace-with-id-storedworkspaceid-not","errorCode":null,"errorMessage":"Stored workspace with id ${storedWorkspaceId} not found","messagePattern":"Stored workspace with id (.+?) not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"packages/server/src/server/handlers/stored-workspaces.ts","lineNumber":124,"sourceCode":"  tags: ['Stored Workspaces'],\n  requiresAuth: true,\n  handler: async ({ mastra, storedWorkspaceId, 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 workspaceStore = await storage.getStore('workspaces');\n      if (!workspaceStore) {\n        throw new HTTPException(500, { message: 'Workspaces storage domain is not available' });\n      }\n\n      const workspace = await workspaceStore.getByIdResolved(storedWorkspaceId);\n\n      if (!workspace) {\n        throw new HTTPException(404, { message: `Stored workspace with id ${storedWorkspaceId} not found` });\n      }\n      assertStoredResourceScope(workspace, await getStoredResourceScope(mastra, requestContext));\n\n      // Throws 404 if the caller isn't the owner, admin, or `stored-workspaces:read[:<id>]` holder.\n      assertReadAccess({\n        requestContext,\n        resource: 'stored-workspaces',\n        resourceId: storedWorkspaceId,\n        record: workspace,\n      });\n\n      return workspace;\n    } catch (error) {\n      return handleError(error, 'Error getting stored workspace');\n    }\n  },\n});\n","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/stored-workspaces.ts#L106-L142","documentation":"The by-ID handler queried workspaceStore.getByIdResolved(id) and got null, meaning no stored workspace exists with that identifier. It throws a 404 (client-correct: the resource simply does not exist). Note the id is the stored record's id (slug), not a runtime workspace key.","triggerScenarios":"GET /api/stored/workspaces/:storedWorkspaceId with an id that was never created, was deleted, or is misspelled; using a runtime workspace name instead of the stored slug id.","commonSituations":"Hardcoded id from an old database; workspace deleted via UI/API by a teammate; assuming auto-increment-style ids instead of the slugified name (toSlug(name) default); wrong environment's database (dev vs prod).","solutions":["List stored workspaces (GET /api/stored/workspaces) to find the correct id","Recreate the workspace with POST /stored/workspaces if it was deleted","Check you are connected to the environment/database where the workspace was created","Pass the exact slug id (e.g. 'my-workspace') — it derives from name via toSlug when id is omitted at create time"],"exampleFix":"// before\nawait fetch('/api/stored/workspaces/my workspace v1'); // spaces/case wrong\n// after\nconst { workspaces } = await fetch('/api/stored/workspaces').then(r => r.json());\nconst ws = workspaces.find(w => w.name === 'My Workspace v1');\nawait fetch(`/api/stored/workspaces/${ws.id}`);","handlingStrategy":"validation","validationCode":"export async function assertWorkspaceExists(baseUrl: string, id: string) {\n  const res = await fetch(`${baseUrl}/api/stored/workspaces/${encodeURIComponent(id)}`);\n  if (res.status === 404) throw new Error(`Workspace '${id}' not found — list /api/stored/workspaces to find valid ids`);\n  return res.json();\n}","typeGuard":"function isStoredWorkspace(x: unknown): x is { id: string; name: string } {\n  return !!x && typeof x === 'object' && typeof (x as any).id === 'string' && typeof (x as any).name === 'string';\n}","tryCatchPattern":"try {\n  return await getStoredWorkspace(id);\n} catch (e: any) {\n  if (e.status === 404 && String(e.message).includes('not found')) {\n    const all = await listStoredWorkspaces();\n    console.error(`Unknown id '${id}'. Known ids: ${all.workspaces.map(w => w.id).join(', ')}`);\n  } else throw e;\n}","preventionTips":["Discover ids via the list endpoint instead of hardcoding","Remember ids default to toSlug(name) at create time","Handle deletions by teammates — re-check existence before reuse","Confirm you are pointed at the right environment's database"],"tags":["not-found","http-404","workspaces","rest"],"backgroundTag":"resource-not-found","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}