{"record":{"id":"9ce2309f16a83db5","repo":"googleapis/mcp-toolbox","slug":"failed-to-get-instrumentation-from-context-w","errorCode":null,"errorMessage":"failed to get instrumentation from context: %w","messagePattern":"failed to get instrumentation from context: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/server/server.go","lineNumber":97,"sourceCode":"\tmap[string]group.Group,\n\terror,\n) {\n\tif cfg.EnableAPI {\n\t\tfor _, sc := range cfg.AuthServiceConfigs {\n\t\t\tif sc.IsMCPEnabled() {\n\t\t\t\treturn nil, nil, nil, nil, nil, nil, fmt.Errorf(\"MCP Auth cannot be enabled together with the legacy HTTP API (EnableAPI)\")\n\t\t\t}\n\t\t}\n\t}\n\n\tmetadataStr := cfg.Version\n\tif len(cfg.UserAgentMetadata) > 0 {\n\t\tmetadataStr += \"+\" + strings.Join(cfg.UserAgentMetadata, \"+\")\n\t}\n\tctx = util.WithUserAgent(ctx, metadataStr)\n\tinstrumentation, err := util.InstrumentationFromContext(ctx)\n\tif err != nil {\n\t\treturn nil, nil, nil, nil, nil, nil, fmt.Errorf(\"failed to get instrumentation from context: %w\", err)\n\t}\n\n\tl, err := util.LoggerFromContext(ctx)\n\tif err != nil {\n\t\treturn nil, nil, nil, nil, nil, nil, fmt.Errorf(\"failed to get logger from context: %w\", err)\n\t}\n\n\t// initialize and validate the sources from configs\n\tsourcesMap := make(map[string]sources.Source)\n\tfor name, sc := range cfg.SourceConfigs {\n\t\ts, err := func() (sources.Source, error) {\n\t\t\tchildCtx, span := instrumentation.Tracer.Start(\n\t\t\t\tctx,\n\t\t\t\t\"toolbox/server/source/init\",\n\t\t\t\ttrace.WithAttributes(attribute.String(\"source_type\", sc.SourceConfigType())),\n\t\t\t\ttrace.WithAttributes(attribute.String(\"source_name\", name)),\n\t\t\t)\n\t\t\tdefer span.End()","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/server/server.go#L79-L115","documentation":"Error \"failed to get instrumentation from context: %w\" thrown in googleapis/mcp-toolbox.","triggerScenarios":"Thrown at internal/server/server.go:97 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}