{"record":{"id":"19c2fb1097b67395","repo":"mastra-ai/mastra","slug":"datasetsstorage-not-configured-configure-storage","errorCode":null,"errorMessage":"DatasetsStorage not configured. Configure storage in Mastra instance.","messagePattern":"DatasetsStorage not configured\\. Configure storage in Mastra instance\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/datasets/experiment/index.ts","lineNumber":255,"sourceCode":"          id,\n          datasetVersion: null,\n          input: dataItem.input,\n          groundTruth: dataItem.groundTruth,\n          expectedTrajectory: dataItem.expectedTrajectory,\n          requestContext: dataItem.requestContext,\n          metadata: dataItem.metadata,\n          resumeSteps: dataItem.resumeSteps,\n          resumeData: dataItem.resumeData,\n          toolMocks: dataItem.toolMocks,\n          unmockedToolPolicy: dataItem.unmockedToolPolicy,\n          scorerIds: dataItem.scorerIds,\n        };\n      });\n      datasetVersion = null;\n    } else if (datasetId) {\n      // Storage-backed data path (existing)\n      if (!datasetsStore) {\n        throw new Error('DatasetsStorage not configured. Configure storage in Mastra instance.');\n      }\n\n      datasetRecord = await datasetsStore.getDatasetById({ id: datasetId, filters: config.filters });\n      if (!datasetRecord) {\n        throw new MastraError({\n          id: 'DATASET_NOT_FOUND',\n          text: `Dataset not found: ${datasetId}`,\n          domain: 'STORAGE',\n          category: 'USER',\n        });\n      }\n\n      datasetVersion = version ?? datasetRecord.version;\n      const versionItems = await datasetsStore.getItemsByVersion({\n        datasetId,\n        version: datasetVersion,\n      });\n","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/datasets/experiment/index.ts#L237-L273","documentation":"runExperiment supports a storage-backed data path when a datasetId is given; that path requires a datasets store to be configured on the Mastra instance. This plain Error is thrown when datasetId is provided but datasetsStore is undefined, i.e. storage was not configured in the Mastra constructor.","triggerScenarios":"Calling runExperiment (directly or via executeRun/startExperiment/startExperimentAsync) with a datasetId while the Mastra instance was constructed without a datasets/storage configuration.","commonSituations":"Running experiments against storage-backed datasets in an app that only used in-memory defaults; forgetting the storage option when instantiating Mastra; moving an experiment runner script into a service without wiring storage.","solutions":["Configure storage on the Mastra instance (pass a storage config/datasets store in the Mastra constructor)","If the data is available inline, pass `data` instead of datasetId so no store is needed","Verify you are calling runExperiment on the same Mastra instance that has storage attached, not a bare/default instance"],"exampleFix":"// before\nconst mastra = new Mastra({ agents: { myAgent } });\nmastra.runExperiment({ datasetId: 'ds_123', ... });\n// after\nconst mastra = new Mastra({ agents: { myAgent }, storage: new MastraStorage({ ... }) });\nmastra.runExperiment({ datasetId: 'ds_123', ... });","handlingStrategy":"validation","validationCode":"const store = mastra.getStorage?.(); // or inspect your Mastra constructor options\nif (!store && config.datasetId) {\n  throw new Error('datasetId requires storage configured on the Mastra instance');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runExperiment(config);\n} catch (err) {\n  if (err instanceof Error && err.message.includes('DatasetsStorage not configured')) {\n    // construct Mastra with storage, or switch to inline data\n  } else throw err;\n}","preventionTips":["Always configure storage on the Mastra instance when using datasets","Use inline `data` for experiments that don't need persistence","Centralize Mastra construction so storage is never omitted","Add a startup assertion that storage is present in dataset-dependent services"],"tags":["configuration","storage","missing-config"],"backgroundTag":"missing-env-var","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}