{"record":{"id":"7726f2f767116771","repo":"mastra-ai/mastra","slug":"observability-storage-batch-create-logs-not-implem","errorCode":"OBSERVABILITY_STORAGE_BATCH_CREATE_LOGS_NOT_IMPLEMENTED","errorMessage":"This storage provider does not support batch creating logs","messagePattern":"This storage provider does not support batch creating logs","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/core/src/storage/domains/observability/base.ts","lineNumber":404,"sourceCode":"   */\n  async batchDeleteTraces(_args: BatchDeleteTracesArgs): Promise<void> {\n    throw new MastraError({\n      id: 'OBSERVABILITY_STORAGE_BATCH_DELETE_TRACES_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,\n      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support batch deleting traces',\n    });\n  }\n\n  // ============================================================================\n  // Logs\n  // ============================================================================\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  }","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/storage/domains/observability/base.ts#L386-L422","documentation":"This error is thrown by the base MastraObservabilityStorage class's batchCreateLogs method, a default implementation that always throws. It means the storage provider has not implemented creating multiple log records in a single batch. The library throws instead of silently inserting logs one at a time so callers can detect the missing capability explicitly.","triggerScenarios":"Calling storage.batchCreateLogs(args) (BatchCreateLogsArgs) on a provider that inherits the base class default, e.g. flushing a buffered batch of log records through the observability storage domain.","commonSituations":"Configuring a log exporter that batches records against a minimal storage adapter; a custom storage driver extending the base without overriding batch methods; using a provider whose logs domain is unimplemented entirely (it will also throw on listLogs); version mismatch where the app uses batch APIs newer than the provider supports.","solutions":["Switch to a storage provider that implements batchCreateLogs.","Insert logs individually via the single-log create API as a fallback.","If you own the provider, override batchCreateLogs to bulk-insert the records.","Catch this error in the log flush path and fall back to sequential inserts (or drop with a warning if logs are non-critical)."],"exampleFix":"// before\nawait storage.batchCreateLogs({ logs });\n// after\ntry {\n  await storage.batchCreateLogs({ logs });\n} catch (e) {\n  if (e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_BATCH_CREATE_LOGS_NOT_IMPLEMENTED') {\n    for (const log of logs) await storage.createLog(log);\n  } else {\n    throw e;\n  }\n}","handlingStrategy":"try-catch","validationCode":"const supportsBatchCreateLogs = typeof storage.batchCreateLogs === 'function' && storage.batchCreateLogs !== MastraObservabilityStorage.prototype.batchCreateLogs;\nif (!supportsBatchCreateLogs) { /* buffer or insert logs one by one */ }","typeGuard":"function supportsBatchCreateLogs(s: unknown): s is MastraObservabilityStorage & { batchCreateLogs: (a: BatchCreateLogsArgs) => Promise<void> } {\n  return s instanceof MastraObservabilityStorage && (s as any).batchCreateLogs !== MastraObservabilityStorage.prototype.batchCreateLogs;\n}","tryCatchPattern":"try {\n  await storage.batchCreateLogs({ logs });\n} catch (e) {\n  if (e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_BATCH_CREATE_LOGS_NOT_IMPLEMENTED') {\n    for (const log of logs) await storage.createLog(log);\n  } else {\n    throw e;\n  }\n}","preventionTips":["Verify the provider supports the logs domain before wiring batch log exporters.","Use a concrete, fully implemented provider instead of the base class.","Feature-detect batchCreateLogs against the base prototype before batching.","Implement batchCreateLogs in custom providers with a single bulk insert.","Make log flushing resilient: fall back to sequential writes when batching is unsupported."],"tags":["storage","observability","not-implemented","logs","batch"],"backgroundTag":"storage-method-not-implemented","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}