{"record":{"id":"5c76b885940ef1fd","repo":"mastra-ai/mastra","slug":"observability-storage-list-logs-not-implemented","errorCode":"OBSERVABILITY_STORAGE_LIST_LOGS_NOT_IMPLEMENTED","errorMessage":"This storage provider does not support listing logs","messagePattern":"This storage provider does not support listing logs","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/core/src/storage/domains/observability/base.ts","lineNumber":416,"sourceCode":"  // ============================================================================\n\n  /**\n   * Creates multiple log records in a single batch.\n   */\n  async batchCreateLogs(_args: BatchCreateLogsArgs): Promise<void> {\n    throw new MastraError({\n      id: 'OBSERVABILITY_STORAGE_BATCH_CREATE_LOGS_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,\n      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support batch creating logs',\n    });\n  }\n\n  /**\n   * Retrieves a list of logs with optional filtering.\n   */\n  async listLogs(_args: ListLogsArgs): Promise<ListLogsResponse> {\n    throw new MastraError({\n      id: 'OBSERVABILITY_STORAGE_LIST_LOGS_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,\n      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support listing logs',\n    });\n  }\n\n  // ============================================================================\n  // Metrics\n  // ============================================================================\n\n  /**\n   * Creates multiple metric observations in a single batch.\n   */\n  async batchCreateMetrics(_args: BatchCreateMetricsArgs): Promise<void> {\n    throw new MastraError({\n      id: 'OBSERVABILITY_STORAGE_BATCH_CREATE_METRICS_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,","sourceCodeStart":398,"sourceCodeEnd":434,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/storage/domains/observability/base.ts#L398-L434","documentation":"This error is thrown by the base MastraObservabilityStorage class's listLogs method, a default implementation that always throws. It means the storage provider does not implement querying/listing log records with optional filters. The library throws to make the missing capability explicit rather than returning an empty result, which would silently hide the fact that logs were never stored or cannot be read.","triggerScenarios":"Calling storage.listLogs(args) (ListLogsArgs) on a provider that inherits the base default, e.g. the log viewer in Studio or an API route fetching logs with date/level filters.","commonSituations":"Browsing logs in the Mastra Studio UI while connected to a storage adapter without log support; querying logs through a custom API endpoint; using a storage backend where the logs domain was never implemented; mistakenly treating the base class as a usable provider.","solutions":["Switch to a storage provider that implements listLogs (a database-backed provider with log support).","Check the provider's capabilities before building log UI/API features on top of it.","If you own the provider, override listLogs to query stored log records with the provided filters.","In UI/API code, catch this error and render a 'logs not supported by this storage provider' state instead of crashing."],"exampleFix":"// before\nconst logs = await storage.listLogs({ fromDate, toDate });\n// after\nlet logs;\ntry {\n  logs = await storage.listLogs({ fromDate, toDate });\n} catch (e) {\n  if (e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_LIST_LOGS_NOT_IMPLEMENTED') {\n    logs = { logs: [], total: 0, unsupported: true };\n  } else {\n    throw e;\n  }\n}","handlingStrategy":"try-catch","validationCode":"const supportsListLogs = typeof storage.listLogs === 'function' && storage.listLogs !== MastraObservabilityStorage.prototype.listLogs;\nif (!supportsListLogs) { /* disable the log viewer / return an empty response */ }","typeGuard":"function supportsListLogs(s: unknown): s is MastraObservabilityStorage & { listLogs: (a: ListLogsArgs) => Promise<ListLogsResponse> } {\n  return s instanceof MastraObservabilityStorage && (s as any).listLogs !== MastraObservabilityStorage.prototype.listLogs;\n}","tryCatchPattern":"try {\n  const logs = await storage.listLogs(args);\n} catch (e) {\n  if (e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_LIST_LOGS_NOT_IMPLEMENTED') {\n    return { logs: [], total: 0 } as ListLogsResponse;\n  }\n  throw e;\n}","preventionTips":["Choose a storage provider with log support if you need the Studio log viewer or log APIs.","Never call listLogs on the base class or a provider known to omit the logs domain.","Feature-detect listLogs against the base prototype before rendering log UI.","Implement listLogs with filtering in any custom provider you author.","Handle the error gracefully in UI layers so log pages degrade instead of crashing."],"tags":["storage","observability","not-implemented","logs","query"],"backgroundTag":"storage-method-not-implemented","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}