{"record":{"id":"9dce6d3c44d4b2e8","repo":"googleapis/mcp-toolbox","slug":"unable-to-create-telemetry-instrumentation-w","errorCode":null,"errorMessage":"unable to create telemetry instrumentation: %w","messagePattern":"unable to create telemetry instrumentation: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/internal/options.go","lineNumber":128,"sourceCode":"\tif err != nil {\n\t\terrMsg := fmt.Errorf(\"error setting up OpenTelemetry: %w\", err)\n\t\tlogger.ErrorContext(ctx, errMsg.Error())\n\t\treturn ctx, nil, errMsg\n\t}\n\n\tshutdownFunc := func(ctx context.Context) error {\n\t\terr := otelShutdown(ctx)\n\t\tif err != nil {\n\t\t\terrMsg := fmt.Errorf(\"error shutting down OpenTelemetry: %w\", err)\n\t\t\tlogger.ErrorContext(ctx, errMsg.Error())\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\n\tinstrumentation, err := telemetry.CreateTelemetryInstrumentation(opts.Cfg.Version)\n\tif err != nil {\n\t\terrMsg := fmt.Errorf(\"unable to create telemetry instrumentation: %w\", err)\n\t\tlogger.ErrorContext(ctx, errMsg.Error())\n\t\treturn ctx, shutdownFunc, errMsg\n\t}\n\n\tctx = util.WithInstrumentation(ctx, instrumentation)\n\n\treturn ctx, shutdownFunc, nil\n}\n\n// GetCustomConfigFiles retrieves the list of custom config file paths\nfunc (opts *ToolboxOptions) GetCustomConfigFiles(ctx context.Context) ([]string, bool, error) {\n\t// Determine if Custom Files should be loaded\n\t// Check for explicit custom flags\n\tisCustomConfigured := opts.Config != \"\" || len(opts.Configs) > 0 || opts.ConfigFolder != \"\"\n\n\tlogger, err := util.LoggerFromContext(ctx)\n\tif err != nil {\n\t\treturn nil, isCustomConfigured, err","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/cmd/internal/options.go#L110-L146","documentation":"After OTel is set up, Setup calls telemetry.CreateTelemetryInstrumentation(opts.Cfg.Version) to build the instrumentation used to annotate the context. If that construction fails, the error is wrapped with this message and startup aborts, returning the shutdownFunc so callers can still clean up OTel.","triggerScenarios":"telemetry.CreateTelemetryInstrumentation returns an error — internal tracer/meter instrumentation construction fails (e.g., instrument naming or registration problem with the OTel SDK).","commonSituations":"A corrupted or incompatible OpenTelemetry SDK version in the dependency graph, or an OTel instrument registration failure after a library upgrade.","solutions":["Check the wrapped root cause from CreateTelemetryInstrumentation","Run go mod tidy / update the OpenTelemetry SDK to a compatible version","Verify no custom resource/instrument registration conflicts in telemetry config","Rebuild with the project's supported Go version (1.23+)"],"exampleFix":"// before\ngo get go.opentelemetry.io/otel@v1.0.0  // old incompatible SDK\n// after\ngo get go.opentelemetry.io/otel@latest && go mod tidy","handlingStrategy":"validation","validationCode":"// pin a compatible OTel SDK and verify build\ngo mod tidy && go build ./... \ngo list -m go.opentelemetry.io/otel","typeGuard":null,"tryCatchPattern":"instrumentation, err := telemetry.CreateTelemetryInstrumentation(version)\nif err != nil {\n    return fmt.Errorf(\"unable to create telemetry instrumentation: %w\", err)\n}","preventionTips":["Keep the OpenTelemetry SDK at a version compatible with the toolbox go.mod","Run go mod tidy after dependency upgrades","Test startup with telemetry enabled in CI"],"tags":["opentelemetry","instrumentation","startup","go"],"backgroundTag":"telemetry-exporter-init-failure","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}