mastra-ai/mastra · error · MastraError

OBSERVABILITY_STORAGE_BATCH_CREATE_LOGS_NOT_IMPLEMENTED

OBSERVABILITY_STORAGE_BATCH_CREATE_LOGS_NOT_IMPLEMENTED

Error message

This storage provider does not support batch creating logs

What it means

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.

Source

Thrown at packages/core/src/storage/domains/observability/base.ts:404

   */
  async batchDeleteTraces(_args: BatchDeleteTracesArgs): Promise<void> {
    throw new MastraError({
      id: 'OBSERVABILITY_STORAGE_BATCH_DELETE_TRACES_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,
      category: ErrorCategory.SYSTEM,
      text: 'This storage provider does not support batch deleting traces',
    });
  }

  // ============================================================================
  // Logs
  // ============================================================================

  /**
   * Creates multiple log records in a single batch.
   */
  async batchCreateLogs(_args: BatchCreateLogsArgs): Promise<void> {
    throw new MastraError({
      id: 'OBSERVABILITY_STORAGE_BATCH_CREATE_LOGS_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,
      category: ErrorCategory.SYSTEM,
      text: 'This storage provider does not support batch creating logs',
    });
  }

  /**
   * Retrieves a list of logs with optional filtering.
   */
  async listLogs(_args: ListLogsArgs): Promise<ListLogsResponse> {
    throw new MastraError({
      id: 'OBSERVABILITY_STORAGE_LIST_LOGS_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,
      category: ErrorCategory.SYSTEM,
      text: 'This storage provider does not support listing logs',
    });
  }

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Switch to a storage provider that implements batchCreateLogs.
  2. Insert logs individually via the single-log create API as a fallback.
  3. If you own the provider, override batchCreateLogs to bulk-insert the records.
  4. Catch this error in the log flush path and fall back to sequential inserts (or drop with a warning if logs are non-critical).

Example fix

// before
await storage.batchCreateLogs({ logs });
// after
try {
  await storage.batchCreateLogs({ logs });
} catch (e) {
  if (e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_BATCH_CREATE_LOGS_NOT_IMPLEMENTED') {
    for (const log of logs) await storage.createLog(log);
  } else {
    throw e;
  }
}
Defensive patterns

Strategy: try-catch

Validate before calling

const supportsBatchCreateLogs = typeof storage.batchCreateLogs === 'function' && storage.batchCreateLogs !== MastraObservabilityStorage.prototype.batchCreateLogs;
if (!supportsBatchCreateLogs) { /* buffer or insert logs one by one */ }

Type guard

function supportsBatchCreateLogs(s: unknown): s is MastraObservabilityStorage & { batchCreateLogs: (a: BatchCreateLogsArgs) => Promise<void> } {
  return s instanceof MastraObservabilityStorage && (s as any).batchCreateLogs !== MastraObservabilityStorage.prototype.batchCreateLogs;
}

Try / catch

try {
  await storage.batchCreateLogs({ logs });
} catch (e) {
  if (e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_BATCH_CREATE_LOGS_NOT_IMPLEMENTED') {
    for (const log of logs) await storage.createLog(log);
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/7726f2f767116771. Report an issue: GitHub.