{"record":{"id":"fb15674123cee832","repo":"mastra-ai/mastra","slug":"durable-agent-list-active-runs-no-storage","errorCode":"DURABLE_AGENT_LIST_ACTIVE_RUNS_NO_STORAGE","errorMessage":"DurableAgent \"${this.name}\" listActiveRuns() requires storage to discover running runs. Register the agent on a Mastra instance with persistent storage (e.g. PostgreSQL, LibSQL). See https://mastra.ai/docs/storage","messagePattern":"DurableAgent \"(.+?)\" listActiveRuns\\(\\) requires storage to discover running runs\\. Register the agent on a Mastra instance with persistent storage \\(e\\.g\\. PostgreSQL, LibSQL\\)\\. See https://mastra\\.ai/docs/storage","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/core/src/agent/durable/durable-agent.ts","lineNumber":2924,"sourceCode":"        category: ErrorCategory.USER,\n        text: `DurableAgent \"${this.name}\" listActiveRuns() requires perPage to be a positive integer.`,\n        details: { agentName: this.name, perPage },\n      });\n    }\n    if (page !== undefined && (!Number.isInteger(page) || page < 0)) {\n      throw new MastraError({\n        id: 'DURABLE_AGENT_LIST_ACTIVE_RUNS_INVALID_PAGE',\n        domain: ErrorDomain.AGENT,\n        category: ErrorCategory.USER,\n        text: `DurableAgent \"${this.name}\" listActiveRuns() requires page to be a non-negative integer.`,\n        details: { agentName: this.name, page },\n      });\n    }\n\n    const workflowsStore = await this.#mastra?.getStorage()?.getStore('workflows');\n\n    if (!workflowsStore) {\n      throw new MastraError({\n        id: 'DURABLE_AGENT_LIST_ACTIVE_RUNS_NO_STORAGE',\n        domain: ErrorDomain.AGENT,\n        category: ErrorCategory.USER,\n        text:\n          `DurableAgent \"${this.name}\" listActiveRuns() requires storage to discover running runs. ` +\n          `Register the agent on a Mastra instance with persistent storage (e.g. PostgreSQL, LibSQL). See https://mastra.ai/docs/storage`,\n        details: { agentName: this.name },\n      });\n    }\n\n    // resourceId is a storage column, so it is pushed down to narrow the query\n    // (the in-process check below remains as backstop for adapters that skip\n    // the filter and for rows persisted before the column was populated).\n    // Filtering by agentId/threadId happens in application code because those\n    // fields only exist inside each row's `snapshot` JSON — storage adapters\n    // have no predicate for them. Fetch candidates in bounded batches so peak\n    // memory is O(batch size) hydrated snapshots instead of every `running`\n    // row's full snapshot at once (#21501). Only the small per-run summary is","sourceCodeStart":2906,"sourceCodeEnd":2942,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/agent/durable/durable-agent.ts#L2906-L2942","documentation":"listActiveRuns() discovers running runs by querying the workflows storage store via this.#mastra?.getStorage()?.getStore('workflows'). If the agent has no Mastra instance or the instance has no persistent storage configured, the store is undefined and the agent cannot enumerate active runs, so it throws instead of silently returning an empty list.","triggerScenarios":"Calling listActiveRuns() on a DurableAgent that was constructed without a Mastra instance, or whose Mastra instance was created without a storage option (e.g. new Mastra({}) with no storage).","commonSituations":"Standalone/in-memory test agents without storage, dev setups that skipped configuring PostgreSQL/LibSQL, or agents instantiated directly rather than registered on a configured Mastra instance.","solutions":["Register the agent on a Mastra instance with persistent storage: new Mastra({ agents: { myAgent }, storage: new PostgresStore(...) }).","Verify the configured storage adapter exposes a workflows store (PostgreSQL, LibSQL, etc.).","In tests, either provide an in-memory/file-backed storage adapter or skip listActiveRuns coverage."],"exampleFix":"// before\nexport const mastra = new Mastra({ agents: { myAgent } });\n// after\nexport const mastra = new Mastra({\n  agents: { myAgent },\n  storage: new PostgresStore({ connectionString: process.env.DATABASE_URL }),\n});","handlingStrategy":"try-catch","validationCode":"const hasStorage = !!mastra?.getStorage?.()?.getStore('workflows');\nif (!hasStorage) {\n  throw new Error('listActiveRuns requires persistent storage on the Mastra instance');\n}\nawait agent.listActiveRuns({ page: 0 });","typeGuard":null,"tryCatchPattern":"import { MastraError } from '@mastra/core/mastra/error';\ntry {\n  const runs = await agent.listActiveRuns({ page: 0 });\n} catch (e) {\n  if (e instanceof MastraError && e.id === 'DURABLE_AGENT_LIST_ACTIVE_RUNS_NO_STORAGE') {\n    logger.warn('No storage configured; active-run listing unavailable');\n    return [];\n  }\n  throw e;\n}","preventionTips":["Always construct Mastra with a persistent storage adapter in environments that use DurableAgent","Add a startup assertion that mastra.getStorage()?.getStore('workflows') resolves","Never instantiate DurableAgents outside a storage-backed Mastra instance in production"],"tags":["storage","configuration","missing-dependency"],"backgroundTag":"missing-storage-configuration","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}