{"record":{"id":"b5673f4c9092406b","repo":"mastra-ai/mastra","slug":"observability-storage-batch-update-spans-not-imple","errorCode":"OBSERVABILITY_STORAGE_BATCH_UPDATE_SPANS_NOT_IMPLEMENTED","errorMessage":"This storage provider does not support batch updating spans","messagePattern":"This storage provider does not support batch updating spans","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/core/src/storage/domains/observability/base.ts","lineNumber":376,"sourceCode":"  }\n\n  /**\n   * Creates multiple Spans in a single batch.\n   */\n  async batchCreateSpans(_args: BatchCreateSpansArgs): Promise<void> {\n    throw new MastraError({\n      id: 'OBSERVABILITY_STORAGE_BATCH_CREATE_SPAN_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,\n      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support batch creating spans',\n    });\n  }\n\n  /**\n   * Updates multiple Spans in a single batch.\n   */\n  async batchUpdateSpans(_args: BatchUpdateSpansArgs): Promise<void> {\n    throw new MastraError({\n      id: 'OBSERVABILITY_STORAGE_BATCH_UPDATE_SPANS_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,\n      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support batch updating spans',\n    });\n  }\n\n  /**\n   * Deletes multiple traces and all their associated spans in a single batch operation.\n   */\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  }","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/storage/domains/observability/base.ts#L358-L394","documentation":"This error is thrown by the base MastraObservabilityStorage class's batchUpdateSpans method, which is a default implementation that always throws. It means the concrete storage provider in use has not overridden batchUpdateSpans, so it does not support updating multiple spans in a single batch operation. The library throws it to signal an unimplemented optional capability rather than silently failing or corrupting trace data.","triggerScenarios":"Calling storage.batchUpdateSpans(args) (BatchUpdateSpansArgs) on a storage provider class that does not override batchUpdateSpans, e.g. a custom provider extending only the base class, or an official provider that has not implemented batch span updates.","commonSituations":"Using a lightweight or in-memory storage adapter that only implements the required observability methods; writing a custom storage driver that extends the base class without implementing batch methods; enabling a tracing/observability exporter that assumes batch span updates are available; upgrading Mastra and enabling a new batch-based span pipeline against an older provider.","solutions":["Check whether your storage provider supports batch span updates; if it does, verify you are instantiating that provider class (not the base class).","Switch to a storage provider that implements batchUpdateSpans (e.g. a database-backed provider like Postgres/LibSQL with full observability support).","Update spans one at a time via the single-span update API if your provider exposes it.","If you own the provider, override batchUpdateSpans to persist all spans in one transaction.","If batching is optional in your integration, catch this error and fall back to per-span updates."],"exampleFix":"// before\nawait storage.batchUpdateSpans({ spans });\n// after\ntry {\n  await storage.batchUpdateSpans({ spans });\n} catch (e) {\n  if (e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_BATCH_UPDATE_SPANS_NOT_IMPLEMENTED') {\n    for (const span of spans) await storage.updateSpan(span);\n  } else {\n    throw e;\n  }\n}","handlingStrategy":"try-catch","validationCode":"const supportsBatchSpanUpdates = typeof storage.batchUpdateSpans === 'function' && !Object.getPrototypeOf(storage).constructor.name.includes('Base') && storage.batchUpdateSpans !== MastraObservabilityStorage.prototype.batchUpdateSpans;\nif (!supportsBatchSpanUpdates) { /* use per-span update path */ }","typeGuard":"function supportsBatchUpdateSpans(s: unknown): s is MastraObservabilityStorage & { batchUpdateSpans: (a: BatchUpdateSpansArgs) => Promise<void> } {\n  return s instanceof MastraObservabilityStorage && (s as any).batchUpdateSpans !== MastraObservabilityStorage.prototype.batchUpdateSpans;\n}","tryCatchPattern":"try {\n  await storage.batchUpdateSpans({ spans });\n} catch (e) {\n  if (e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_BATCH_UPDATE_SPANS_NOT_IMPLEMENTED') {\n    await Promise.all(spans.map(s => storage.updateSpan(s)));\n  } else {\n    throw e;\n  }\n}","preventionTips":["Check the provider's documentation/implemented methods before relying on batch observability APIs.","Verify which concrete storage class you instantiate — never use the base class directly.","Feature-detect batch methods (compare against the base prototype) before calling them.","When writing custom providers, implement all batch methods you intend callers to use.","Add an integration test asserting batch behavior for every storage provider you ship."],"tags":["storage","observability","not-implemented","spans","batch"],"backgroundTag":"storage-method-not-implemented","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}