{"record":{"id":"a2b66e1023bc0521","repo":"mastra-ai/mastra","slug":"observability-storage-get-root-span-not-implemente","errorCode":"OBSERVABILITY_STORAGE_GET_ROOT_SPAN_NOT_IMPLEMENTED","errorMessage":"This storage provider does not support getting root spans","messagePattern":"This storage provider does not support getting root spans","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/core/src/storage/domains/observability/base.ts","lineNumber":202,"sourceCode":"  }\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  }\n\n  /**\n   * Retrieves a single trace with all its associated spans.\n   */\n  async getTrace(_args: GetTraceArgs): Promise<GetTraceResponse | null> {\n    throw new MastraError({\n      id: 'OBSERVABILITY_STORAGE_GET_TRACE_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,\n      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support getting traces',\n    });\n  }","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/storage/domains/observability/base.ts#L184-L220","documentation":"getRootSpan() in the ObservabilityStorage base class throws by default; it is only available on adapters that override it. Hitting this error means the configured storage cannot resolve a single root span by id.","triggerScenarios":"Calling await storage.getObservability().getRootSpan(args) on a backend that does not override the method — typically while resolving the top-level span of a trace for UI drill-down.","commonSituations":"Custom storage adapter implementing only write-side observability APIs; legacy adapter versions predating the root-span read API; pointing playground/agent traces UI at unsupported storage.","solutions":["Use a storage adapter that implements the observability read domain (overrides getRootSpan).","Fetch the full trace with getTrace() and derive the root span (span with no parentId) client-side.","Override getRootSpan() in your adapter (SELECT ... WHERE spanId = ? AND parentId IS NULL, or lookup the trace and filter).","Guard with a capability check and fall back to getTrace-based resolution."],"exampleFix":"// before\nconst root = await observability.getRootSpan({ spanId });\n\n// after (fallback)\nconst trace = await observability.getTrace({ traceId: span.traceId });\nconst root = trace?.spans.find(s => !s.parentSpanId) ?? null;","handlingStrategy":"fallback","validationCode":"const supportsRootSpan = obs.getRootSpan !== ObservabilityStorage.prototype.getRootSpan;","typeGuard":"function supportsGetRootSpan(o: { getRootSpan: unknown }): boolean {\n  return o.getRootSpan !== (ObservabilityStorage.prototype as any).getRootSpan;\n}","tryCatchPattern":"try {\n  return await obs.getRootSpan(args);\n} catch (e) {\n  if ((e as MastraError).id === 'OBSERVABILITY_STORAGE_GET_ROOT_SPAN_NOT_IMPLEMENTED') {\n    const trace = await obs.getTrace(args).catch(() => null);\n    return trace?.spans.find(s => !s.parentSpanId) ?? null;\n  }\n  throw e;\n}","preventionTips":["Derive root spans from a full getTrace() when the backend lacks getRootSpan.","Verify adapter capability at startup, not per-request.","Keep adapter and @mastra/core versions aligned."],"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"}