{"record":{"id":"3076f5fe6426e506","repo":"mastra-ai/mastra","slug":"experiments-storage-not-available","errorCode":null,"errorMessage":"Experiments storage not available","messagePattern":"Experiments storage not available","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"packages/server/src/server/handlers/datasets.ts","lineNumber":623,"sourceCode":"  path: '/experiments',\n  responseType: 'json',\n  queryParamSchema: listExperimentsQuerySchema,\n  responseSchema: listExperimentsResponseSchema,\n  summary: 'List all experiments',\n  description: 'Returns a paginated list of all experiments across all datasets',\n  tags: ['Experiments'],\n  requiresAuth: true,\n  handler: async ({ mastra, ...params }) => {\n    assertDatasetsAvailable();\n    try {\n      const { page, perPage, experimentSetId, comparisonId, variantId, trialIndex } = params;\n      const storage = mastra.getStorage();\n      if (!storage) {\n        throw new HTTPException(500, { message: 'Storage not configured' });\n      }\n      const experimentsStore = await storage.getStore('experiments');\n      if (!experimentsStore) {\n        throw new HTTPException(500, { message: 'Experiments storage not available' });\n      }\n      const result = await experimentsStore.listExperiments({\n        experimentSetId,\n        comparisonId,\n        variantId,\n        trialIndex,\n        pagination: { page: page ?? 0, perPage: perPage ?? 20 },\n      });\n      return { experiments: result.experiments, pagination: result.pagination };\n    } catch (error) {\n      if (error instanceof MastraError) {\n        throw new HTTPException(getHttpStatusForMastraError(error.id) as StatusCode, { message: error.message });\n      }\n      return handleError(error, 'Error listing experiments');\n    }\n  },\n});\n","sourceCodeStart":605,"sourceCodeEnd":641,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/datasets.ts#L605-L641","documentation":"This HTTPException(500) is thrown by the LIST_EXPERIMENTS route handler in packages/server/src/server/handlers/datasets.ts when the configured Mastra storage does not provide an 'experiments' domain store. The server requires an experiments-backed storage class (e.g. Postgres/LibSQL with experiments support); a storage backend without that store cannot serve experiment listing. It is a server-configuration problem, not a client error.","triggerScenarios":"GET the experiments list endpoint when mastra.getStorage() returns a valid storage instance but await storage.getStore('experiments') returns undefined — i.e. the storage class in use does not implement the experiments store.","commonSituations":"Mastra configured with an in-memory or minimal storage class that lacks experiments support; older storage package versions predating the experiments store; forgetting to pass a storage class to Mastra's storage option (only caught earlier when storage itself is null).","solutions":["Configure a storage backend that implements the experiments store (e.g. @mastra/pg or @mastra/libsql) in the Mastra instance.","Upgrade the storage package to a version that supports the experiments domain.","Verify with a runtime check that await storage.getStore('experiments') resolves before deploying routes that depend on it."],"exampleFix":"// before\nnew Mastra({ storage: new InMemoryStorage() });\n// after\nimport { MastraStorage } from '@mastra/pg';\nnew Mastra({ storage: new MastraStorage({ connectionString: process.env.DATABASE_URL }) });","handlingStrategy":"fallback","validationCode":"const storage = mastra.getStorage();\nconst experimentsStore = storage ? await storage.getStore('experiments') : undefined;\nif (!experimentsStore) {\n  throw new Error('Server storage does not support experiments; configure @mastra/pg or @mastra/libsql');\n}","typeGuard":"function hasExperimentsStore(s: unknown): s is { getStore: (d: 'experiments') => Promise<unknown> } {\n  return !!s && typeof (s as any).getStore === 'function';\n}","tryCatchPattern":"try {\n  const res = await fetch('/api/datasets/experiments');\n  if (res.status === 500) {\n    const body = await res.text();\n    if (body.includes('Experiments storage not available')) {\n      // surface a config-level failure, not a transient error\n    }\n  }\n} catch (e) { /* network */ }","preventionTips":["Use a storage backend documented to support the experiments domain.","Assert experiments store availability in a startup smoke test.","Pin storage package versions known to implement experiments."],"tags":["storage","server","configuration","experiments"],"backgroundTag":"storage-backend-not-supported","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}