{"record":{"id":"df487ce6ca32b2c5","repo":"jaegertracing/jaeger","slug":"invalid-otlp-proxy-target-q-w","errorCode":null,"errorMessage":"invalid OTLP proxy target %q: %w","messagePattern":"invalid OTLP proxy target %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/jaeger/internal/extension/jaegerquery/internal/server.go","lineNumber":369,"sourceCode":"\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n}\n\nfunc registerMCPTools(r *http.ServeMux, querySvc *querysvc.QueryService, tenancyMgr *tenancy.Manager, basePath string, cfg mcptools.Config, telset telemetry.Settings) {\n\thandler := mcptools.NewHandler(telset, querySvc, tenancyMgr, cfg)\n\tprefix := strings.TrimSuffix(basePath, \"/\") + \"/api/ai/mcp\"\n\tr.Handle(prefix+\"/\", http.StripPrefix(prefix, handler))\n\ttelset.Logger.Info(\"Jaeger telemetry MCP endpoint enabled\", zap.String(\"path\", prefix+\"/\"))\n}\n\n// per-route wrap is the only instrumentation layer.\nfunc registerOTLPProxy(r *http.ServeMux, queryOpts *QueryOptions, telset telemetry.Settings) error {\n\tcfg := queryOpts.OTLPProxy.Get()\n\ttarget, err := url.Parse(cfg.Target)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid OTLP proxy target %q: %w\", cfg.Target, err)\n\t}\n\tproxy := httputil.NewSingleHostReverseProxy(target)\n\tprefix := otlpProxyPathPrefix(queryOpts.BasePath)\n\tinstrumented := otelhttp.NewHandler(\n\t\thttp.StripPrefix(prefix, proxy),\n\t\t\"otlp.proxy\",\n\t\totelhttp.WithTracerProvider(nooptrace.NewTracerProvider()),\n\t\totelhttp.WithMeterProvider(telset.MeterProvider),\n\t)\n\tr.Handle(prefix+\"/v1/\", instrumented)\n\ttelset.Logger.Info(\"OTLP proxy registered\",\n\t\tzap.String(\"path_prefix\", prefix+\"/v1/\"),\n\t\tzap.String(\"target\", cfg.Target))\n\treturn nil\n}\n\nfunc createHTTPServer(\n\tctx context.Context,","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/cmd/jaeger/internal/extension/jaegerquery/internal/server.go#L351-L387","documentation":"registerOTLPProxy configures the reverse proxy that forwards OTLP ingestion requests from the query server to a target collector endpoint. Before building the httputil.ReverseProxy it calls url.Parse on the configured target string; if that string is not a parseable URL the registration fails fast with this wrapped error. The intent is to surface a misconfigured proxy target at startup rather than at first request time.","triggerScenarios":"Starting the jaeger-query server with the OTLP proxy enabled (queryOptions.OTLPProxy.Target set) while cfg.Target cannot be parsed by net/url.Parse — e.g. \"localhost:4318\" with stray characters, \"http://[bad-ipv6\", or a value containing control characters or raw spaces.","commonSituations":"Typing the target into YAML/CLI config without the scheme and quoting it incorrectly; pasting a URL with trailing whitespace or an unescaped bracket in an IPv6 literal; setting the value via an env var that contains newlines; mixing up the OTLP gRPC host:port form (host:port) with the HTTP URL form the proxy expects.","solutions":["Set the OTLP proxy target to a fully parseable URL, including scheme, e.g. http://localhost:4318 or https://collector:4318","Inspect the quoted target in the error message for hidden whitespace, newlines, or unescaped IPv6 brackets and fix or remove them","If the target comes from an env var or config file, echo/printf it and pipe through a URL validator before starting the server"],"exampleFix":"// before\notlp-proxy:\n  target: \"localhost:4318[\"\n// after\notlp-proxy:\n  target: \"http://localhost:4318\"","handlingStrategy":"validation","validationCode":"// validate before passing to the query options\nfunc validOTLPProxyTarget(target string) error {\n\tu, err := url.Parse(target)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid target %q: %w\", target, err)\n\t}\n\tif u.Scheme != \"http\" && u.Scheme != \"https\" {\n\t\treturn fmt.Errorf(\"target %q must be an http(s) URL\", target)\n\t}\n\tif u.Host == \"\" {\n\t\treturn fmt.Errorf(\"target %q missing host\", target)\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include the scheme (http:// or https://) in the OTLP proxy target config","Trim whitespace/newlines from values read from env vars or YAML before use","Validate the target with net/url.Parse in CI or at config-load time so failures surface before server start"],"tags":["config","http","url-parsing","otlp","startup"],"backgroundTag":"invalid-url","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}