mastra-ai/mastra · error · MastraError

OBSERVABILITY_STORAGE_UPDATE_SPAN_NOT_IMPLEMENTED

OBSERVABILITY_STORAGE_UPDATE_SPAN_NOT_IMPLEMENTED

Error message

This storage provider does not support updating spans

What it means

The ObservabilityStorage base class (packages/core/src/storage/domains/observability/base.ts) provides a default updateSpan() that unconditionally throws this MastraError. It means the concrete storage adapter in use has not implemented span updates. The method is also deprecated: the library expects all span data to be written before the span ends, and updateSpan will be removed in the future.

Source

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

   */
  async createSpan(_args: CreateSpanArgs): Promise<void> {
    throw new MastraError({
      id: 'OBSERVABILITY_CREATE_SPAN_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,
      category: ErrorCategory.SYSTEM,
      text: 'This storage provider does not support creating spans',
    });
  }

  /**
   * Updates a single Span with partial data. Primarily used for realtime trace creation.
   *
   * @deprecated This method only works with stores that support span updates,
   * It will be removed in the future. Instead try to add all data to a span before
   * ending it.
   */
  async updateSpan(_args: UpdateSpanArgs): Promise<void> {
    throw new MastraError({
      id: 'OBSERVABILITY_STORAGE_UPDATE_SPAN_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,
      category: ErrorCategory.SYSTEM,
      text: 'This storage provider does not support updating spans',
    });
  }

  /**
   * Retrieves a single span.
   */
  async getSpan(_args: GetSpanArgs): Promise<GetSpanResponse | null> {
    throw new MastraError({
      id: 'OBSERVABILITY_STORAGE_GET_SPAN_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,
      category: ErrorCategory.SYSTEM,
      text: 'This storage provider does not support getting spans',
    });
  }

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Stop calling updateSpan; add all span data (attributes, events, status) before ending the span so a single create/export call suffices.
  2. Check your storage adapter's documentation to confirm whether span updates are supported; if not, remove updateSpan usage from your observability pipeline.
  3. If you own the storage adapter, override updateSpan() to persist the update (e.g. an UPSERT keyed by spanId).
  4. If you only need trace inspection, use getTrace/getSpans instead of mutating stored spans.

Example fix

// before
await observability.updateSpan({ spanId, endTime: Date.now() });

// after
await observability.exportSpan({ ...span, endTime: Date.now(), status: 'ENDED' });
Defensive patterns

Strategy: fallback

Validate before calling

import { ObservabilityStorage } from '@mastra/core/storage';
const supportsUpdate = obs.updateSpan !== ObservabilityStorage.prototype.updateSpan;

Type guard

function supportsSpanUpdate(o: { updateSpan: unknown }): boolean {
  return typeof o.updateSpan === 'function' &&
    o.updateSpan !== (ObservabilityStorage.prototype as any).updateSpan;
}

Try / catch

try {
  await obs.updateSpan(args);
} catch (e) {
  if ((e as MastraError).id === 'OBSERVABILITY_STORAGE_UPDATE_SPAN_NOT_IMPLEMENTED') {
    logger.warn('Span updates unsupported; write span data before ending the span.');
  } else throw e;
}

Prevention

When it happens

Trigger: Calling await storage.getObservability().updateSpan(args) (directly or via an observability exporter/processor) on a storage adapter that only supports span creation (batchCreateSpans/exportSpan) and did not override updateSpan.

Common situations: Using a minimal or custom MastraStorage subclass that implements only the required domains; using a storage backend (e.g. some lightweight/upstash-style adapters) that persists spans append-only; following older docs/examples that rely on the deprecated updateSpan API after the backend dropped support for it.

Related errors


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