mastra-ai/mastra · error · MastraError
OBSERVABILITY_STORAGE_BATCH_DELETE_TRACES_NOT_IMPLEMENTED
OBSERVABILITY_STORAGE_BATCH_DELETE_TRACES_NOT_IMPLEMENTED
Error message
This storage provider does not support batch deleting traces
What it means
This error is thrown by the base MastraObservabilityStorage class's batchDeleteTraces method, a default implementation that always throws. It indicates the concrete storage provider has not implemented batch deletion of traces together with their associated spans. The library surfaces this as an explicit error so callers know the provider lacks this optional capability instead of performing a partial or unsafe delete.
Source
Thrown at packages/core/src/storage/domains/observability/base.ts:388
}
/**
* Updates multiple Spans in a single batch.
*/
async batchUpdateSpans(_args: BatchUpdateSpansArgs): Promise<void> {
throw new MastraError({
id: 'OBSERVABILITY_STORAGE_BATCH_UPDATE_SPANS_NOT_IMPLEMENTED',
domain: ErrorDomain.MASTRA_OBSERVABILITY,
category: ErrorCategory.SYSTEM,
text: 'This storage provider does not support batch updating spans',
});
}
/**
* Deletes multiple traces and all their associated spans in a single batch operation.
*/
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,View on GitHub (pinned to 75dd419e61)
Solutions
- Use a storage provider that implements batchDeleteTraces if bulk trace deletion is required.
- Fall back to deleting traces (and their spans) one by one via the single-trace delete API.
- If you own the provider, override batchDeleteTraces with a transactional bulk delete of traces plus associated spans.
- Guard cleanup code by catching this error and switching to the per-trace deletion path.
Example fix
// before
await storage.batchDeleteTraces({ traceIds });
// after
try {
await storage.batchDeleteTraces({ traceIds });
} catch (e) {
if (e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_BATCH_DELETE_TRACES_NOT_IMPLEMENTED') {
for (const id of traceIds) await storage.deleteTrace(id);
} else {
throw e;
}
} Defensive patterns
Strategy: try-catch
Validate before calling
const supportsBatchDeleteTraces = typeof storage.batchDeleteTraces === 'function' && storage.batchDeleteTraces !== MastraObservabilityStorage.prototype.batchDeleteTraces;
if (!supportsBatchDeleteTraces) { /* use per-trace delete path */ } Type guard
function supportsBatchDeleteTraces(s: unknown): s is MastraObservabilityStorage & { batchDeleteTraces: (a: BatchDeleteTracesArgs) => Promise<void> } {
return s instanceof MastraObservabilityStorage && (s as any).batchDeleteTraces !== MastraObservabilityStorage.prototype.batchDeleteTraces;
} Try / catch
try {
await storage.batchDeleteTraces({ traceIds });
} catch (e) {
if (e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_BATCH_DELETE_TRACES_NOT_IMPLEMENTED') {
for (const id of traceIds) await storage.deleteTrace(id);
} else {
throw e;
}
} Prevention
- Confirm the storage provider implements trace batch deletion before building retention/cleanup jobs.
- Avoid instantiating the base MastraObservabilityStorage directly; use a concrete provider.
- Feature-detect the method against the base prototype before calling it.
- Implement batchDeleteTraces in custom providers, deleting spans together with traces atomically.
- Test cleanup jobs against every provider configuration used in production.
When it happens
Trigger: Calling storage.batchDeleteTraces(args) (BatchDeleteTracesArgs) on a provider that inherits the base implementation, e.g. deleting old trace data in bulk through the observability storage domain.
Common situations: Implementing trace retention/cleanup jobs against a minimal storage adapter; using a provider that only implements single-trace deletion; a custom driver extending MastraObservabilityStorage without overriding batch methods; wiring an admin UI delete-all-traces action to a provider lacking batch support.
Related errors
- OBSERVABILITY_STORAGE_BATCH_UPDATE_SPANS_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_BATCH_CREATE_LOGS_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_LIST_LOGS_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_BATCH_CREATE_METRICS_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_LIST_METRICS_NOT_IMPLEMENTED
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/ab295be5f9f14d55.
Report an issue: GitHub.