mastra-ai/mastra · error · MastraError

OBSERVABILITY_CREATE_SPAN_NOT_IMPLEMENTED

OBSERVABILITY_CREATE_SPAN_NOT_IMPLEMENTED

Error message

This storage provider does not support creating spans

What it means

The base ObservabilityStorageDomain.createSpan is a default implementation for storage providers that do not implement span persistence. It throws a MastraError with id OBSERVABILITY_CREATE_SPAN_NOT_IMPLEMENTED (domain MASTRA_OBSERVABILITY, category SYSTEM) when the provider was not overridden with a real createSpan. It tells you the chosen storage backend cannot store observability spans.

Source

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

  public get runtimeTracingStrategy(): TracingStorageStrategy | undefined {
    const supportedStrategies = this.observabilityStrategy.supported;
    return supportedStrategies.length === 1 ? supportedStrategies[0] : undefined;
  }

  /**
   * Optional feature list for observability storage APIs.
   * Stores should override this to opt in to the APIs they support explicitly.
   * Older stores and older package versions will simply omit it, which keeps page mode working.
   */
  public getFeatures(): readonly ObservabilityStorageFeature[] | undefined {
    return undefined;
  }

  /**
   * Creates a single Span record in the storage provider.
   */
  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,

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Implement createSpan in your storage adapter (persist the CreateSpanArgs payload).
  2. Switch to a storage provider that supports observability spans (e.g. an official provider with the domain implemented).
  3. Disable storage-backed span export and use an external trace exporter (e.g. OTLP) instead.
  4. Check that you are using the provider's latest version — support may have been added in a newer release.

Example fix

// before
new Mastra({ storage: myMinimalStorage, observability: { exports: [storageExporter] } });
// after
// either remove the storage span exporter:
new Mastra({ storage: myMinimalStorage, observability: { exports: [new OTLPExporter()] } });
// or implement in the adapter:
class MyStorage extends BaseStorage {
  async createSpan(args: CreateSpanArgs) { await this.insertSpanRow(args); }
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (typeof (storage as any).createSpan?.prototype !== 'undefined' && storage.createSpan === BaseStorage.prototype.createSpan) {
  throw new Error(`${storage.constructor.name} does not support spans; use an external exporter`);
}

Type guard

function supportsSpanCreation(storage: MastraStorage): boolean {
  return storage.createSpan !== undefined && storage.createSpan !== (BaseStorage.prototype as any).createSpan;
}

Try / catch

try {
  await storage.createSpan(spanArgs);
} catch (e) {
  if (e instanceof MastraError && e.id === 'OBSERVABILITY_CREATE_SPAN_NOT_IMPLEMENTED') {
    // fall back to an external OTLP exporter instead of storage-backed tracing
  } else throw e;
}

Prevention

When it happens

Trigger: Configuring a storage provider that has not implemented createSpan (uses the base-class default) while enabling tracing/observability so spans are written to storage instead of (or in addition to) an exporter.

Common situations: Using a minimal or custom storage adapter that only implements the core domains; enabling AI tracing with a storage backend lacking observability support; upgrading Mastra and turning on storage-backed tracing with an older/third-party provider.

Related errors


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