mastra-ai/mastra · error · MastraError
OBSERVABILITY_STORAGE_GET_SPAN_NOT_IMPLEMENTED
OBSERVABILITY_STORAGE_GET_SPAN_NOT_IMPLEMENTED
Error message
This storage provider does not support getting spans
What it means
getSpan() on the ObservabilityStorage base class throws by default, signaling that the active storage adapter does not implement single-span retrieval. The library surfaces it as a SYSTEM-category MastraError so callers know the backend lacks this capability rather than simply having no data.
Source
Thrown at packages/core/src/storage/domains/observability/base.ts:190
*
* @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',
});
}
/**
* Retrieves a single root span.
*/
async getRootSpan(_args: GetRootSpanArgs): Promise<GetRootSpanResponse | null> {
throw new MastraError({
id: 'OBSERVABILITY_STORAGE_GET_ROOT_SPAN_NOT_IMPLEMENTED',
domain: ErrorDomain.MASTRA_OBSERVABILITY,
category: ErrorCategory.SYSTEM,
text: 'This storage provider does not support getting root spans',
});
}View on GitHub (pinned to 75dd419e61)
Solutions
- Switch to a storage adapter that implements observability reads (e.g. PostgreSQL/pg, libsql, upstash variants that override getSpan).
- Use listTraces/getTrace (if implemented) instead of fetching an individual span.
- Override getSpan() in your custom adapter to query spans by spanId.
- Feature-detect capability before calling (see type guard) and degrade gracefully in your UI.
Defensive patterns
Strategy: try-catch
Validate before calling
const supportsGetSpan = obs.getSpan !== ObservabilityStorage.prototype.getSpan;
Type guard
function supportsGetSpan(o: { getSpan: unknown }): o is { getSpan: (a: any) => Promise<any> } {
return o.getSpan !== (ObservabilityStorage.prototype as any).getSpan;
} Try / catch
try {
return await obs.getSpan({ spanId });
} catch (e) {
if ((e as MastraError).id === 'OBSERVABILITY_STORAGE_GET_SPAN_NOT_IMPLEMENTED') {
return null;
}
throw e;
} Prevention
- Pick storage adapters that implement the full observability read domain for trace UIs.
- Feature-detect getSpan before rendering single-span views.
- Add an integration test that calls getSpan against your configured adapter.
When it happens
Trigger: Calling await storage.getObservability().getSpan({ spanId }) (or a UI/server route that resolves a single span) against an adapter that never overrode getSpan.
Common situations: Building a custom storage integration that implements saveTraces/export but not the read APIs; pointing a trace-debugging UI at a storage backend without span reads; migrating between adapters where the new one supports fewer observability read methods.
Related errors
- OBSERVABILITY_STORAGE_UPDATE_SPAN_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_GET_ROOT_SPAN_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_GET_TRACE_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_GET_STRUCTURE_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_GET_TRACE_LIGHT_NOT_IMPLEMENTED
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/5601b646705f73f2.
Report an issue: GitHub.