{"record":{"id":"fb61ec16282fb5bb","repo":"github/github-mcp-server","slug":"failed-to-create-observability-exporters-w-fb61ec","errorCode":null,"errorMessage":"failed to create observability exporters: %w","messagePattern":"failed to create observability exporters: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/http/server.go","lineNumber":148,"sourceCode":"\t\treturn fmt.Errorf(\"failed to parse API host: %w\", err)\n\t}\n\thostType, err := utils.ParseHostType(cfg.Host)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to classify API host: %w\", err)\n\t}\n\n\trepoAccessOpts := []lockdown.RepoAccessOption{\n\t\tlockdown.WithLogger(logger.With(\"component\", \"lockdown\")),\n\t}\n\tif cfg.RepoAccessCacheTTL != nil {\n\t\trepoAccessOpts = append(repoAccessOpts, lockdown.WithTTL(*cfg.RepoAccessCacheTTL))\n\t}\n\n\tfeatureChecker := createHTTPFeatureChecker(cfg.EnabledFeatures, cfg.InsidersMode)\n\n\tobs, err := observability.NewExporters(logger, metrics.NewNoopMetrics())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create observability exporters: %w\", err)\n\t}\n\n\tdeps := github.NewRequestDeps(\n\t\tapiHost,\n\t\tcfg.Version,\n\t\tcfg.LockdownMode,\n\t\trepoAccessOpts,\n\t\tt,\n\t\tcfg.ContentWindowSize,\n\t\tfeatureChecker,\n\t\tobs,\n\t)\n\n\t// Initialize the global tool scope map\n\terr = initGlobalToolScopeMap(t, hostType)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to initialize tool scope map: %w\", err)\n\t}","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/http/server.go#L130-L166","documentation":"observability.NewExporters returned an error: it requires a non-nil *slog.Logger and a non-nil metrics.Metrics implementation. In RunHTTPServer both are always constructed (logger above, metrics.NewNoopMetrics()), so this branch is defensive; it becomes reachable in code that embeds or reuses NewExporters with nil arguments.","triggerScenarios":"Custom integrations calling NewExporters(nil, nil); refactors that make the logger variable conditional and nil on some path.","commonSituations":"Embedding the server into another binary and skipping logger wiring; copy-pasted startup code that drops the logger argument.","solutions":["Pass a real logger, or slog.New(slog.DiscardHandler) when logs are unwanted","Pass metrics.NewNoopMetrics() when metrics are unwanted","Fail fast on nil observability deps in your own wiring code"],"exampleFix":"// before\nobs, err := observability.NewExporters(nil, nil)\n\n// after\nobs, err := observability.NewExporters(slog.New(slog.DiscardHandler), metrics.NewNoopMetrics())","handlingStrategy":"validation","validationCode":"if logger == nil {\n\tlogger = slog.New(slog.DiscardHandler)\n}\nif m == nil {\n\tm = metrics.NewNoopMetrics()\n}\nobs, err := observability.NewExporters(logger, m)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pass nil logger or metrics to NewExporters","Default to slog discard handler and noop metrics rather than nil","Add nil-argument checks in your own wiring code to fail fast"],"tags":["observability","validation","configuration"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}