github/github-mcp-server · warning
failed to create observability exporters: %w
Error message
failed to create observability exporters: %w
What it means
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.
Source
Thrown at pkg/http/server.go:148
return fmt.Errorf("failed to parse API host: %w", err)
}
hostType, err := utils.ParseHostType(cfg.Host)
if err != nil {
return fmt.Errorf("failed to classify API host: %w", err)
}
repoAccessOpts := []lockdown.RepoAccessOption{
lockdown.WithLogger(logger.With("component", "lockdown")),
}
if cfg.RepoAccessCacheTTL != nil {
repoAccessOpts = append(repoAccessOpts, lockdown.WithTTL(*cfg.RepoAccessCacheTTL))
}
featureChecker := createHTTPFeatureChecker(cfg.EnabledFeatures, cfg.InsidersMode)
obs, err := observability.NewExporters(logger, metrics.NewNoopMetrics())
if err != nil {
return fmt.Errorf("failed to create observability exporters: %w", err)
}
deps := github.NewRequestDeps(
apiHost,
cfg.Version,
cfg.LockdownMode,
repoAccessOpts,
t,
cfg.ContentWindowSize,
featureChecker,
obs,
)
// Initialize the global tool scope map
err = initGlobalToolScopeMap(t, hostType)
if err != nil {
return fmt.Errorf("failed to initialize tool scope map: %w", err)
}View on GitHub (pinned to 0ea1f775a7)
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
Example fix
// before obs, err := observability.NewExporters(nil, nil) // after obs, err := observability.NewExporters(slog.New(slog.DiscardHandler), metrics.NewNoopMetrics())
Defensive patterns
Strategy: validation
Validate before calling
if logger == nil {
logger = slog.New(slog.DiscardHandler)
}
if m == nil {
m = metrics.NewNoopMetrics()
}
obs, err := observability.NewExporters(logger, m) Prevention
- 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
When it happens
Trigger: Custom integrations calling NewExporters(nil, nil); refactors that make the logger variable conditional and nil on some path.
Common situations: Embedding the server into another binary and skipping logger wiring; copy-pasted startup code that drops the logger argument.
Related errors
- unknown tools specified in WithTools
- creating installation token request: %w
- unknown tools specified in WithTools: %s
- could not parse host as URL: %s
- authentication required: set GITHUB_PERSONAL_ACCESS_TOKEN, c
AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15).
Data as JSON: /api/errors/fb61ec16282fb5bb.
Report an issue: GitHub.