{"record":{"id":"5601b646705f73f2","repo":"mastra-ai/mastra","slug":"observability-storage-get-span-not-implemented","errorCode":"OBSERVABILITY_STORAGE_GET_SPAN_NOT_IMPLEMENTED","errorMessage":"This storage provider does not support getting spans","messagePattern":"This storage provider does not support getting spans","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/core/src/storage/domains/observability/base.ts","lineNumber":190,"sourceCode":"   *\n   * @deprecated This method only works with stores that support span updates,\n   * It will be removed in the future. Instead try to add all data to a span before\n   * ending it.\n   */\n  async updateSpan(_args: UpdateSpanArgs): Promise<void> {\n    throw new MastraError({\n      id: 'OBSERVABILITY_STORAGE_UPDATE_SPAN_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,\n      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support updating spans',\n    });\n  }\n\n  /**\n   * Retrieves a single span.\n   */\n  async getSpan(_args: GetSpanArgs): Promise<GetSpanResponse | null> {\n    throw new MastraError({\n      id: 'OBSERVABILITY_STORAGE_GET_SPAN_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,\n      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support getting spans',\n    });\n  }\n\n  /**\n   * Retrieves a single root span.\n   */\n  async getRootSpan(_args: GetRootSpanArgs): Promise<GetRootSpanResponse | null> {\n    throw new MastraError({\n      id: 'OBSERVABILITY_STORAGE_GET_ROOT_SPAN_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,\n      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support getting root spans',\n    });\n  }","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/storage/domains/observability/base.ts#L172-L208","documentation":"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.","triggerScenarios":"Calling await storage.getObservability().getSpan({ spanId }) (or a UI/server route that resolves a single span) against an adapter that never overrode getSpan.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const supportsGetSpan = obs.getSpan !== ObservabilityStorage.prototype.getSpan;","typeGuard":"function supportsGetSpan(o: { getSpan: unknown }): o is { getSpan: (a: any) => Promise<any> } {\n  return o.getSpan !== (ObservabilityStorage.prototype as any).getSpan;\n}","tryCatchPattern":"try {\n  return await obs.getSpan({ spanId });\n} catch (e) {\n  if ((e as MastraError).id === 'OBSERVABILITY_STORAGE_GET_SPAN_NOT_IMPLEMENTED') {\n    return null;\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["storage","observability","tracing","unsupported-operation"],"backgroundTag":"storage-provider-not-implemented","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}