{"record":{"id":"d44309dba4722091","repo":"googleapis/mcp-toolbox","slug":"failed-to-parse-baseurl-v","errorCode":null,"errorMessage":"failed to parse BaseUrl %v","messagePattern":"failed to parse BaseUrl (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/http/http.go","lineNumber":117,"sourceCode":"\t}\n\n\tlogger, err := util.LoggerFromContext(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to get logger from ctx: %s\", err)\n\t}\n\n\tif r.DisableSslVerification {\n\t\ttr.TLSClientConfig = &tls.Config{\n\t\t\tInsecureSkipVerify: true,\n\t\t}\n\n\t\tlogger.WarnContext(ctx, \"WARNING: TLS certificate verification is skipped (InsecureSkipVerify: true) for HTTP source %s. This exposes all traffic for this source to Man-in-the-Middle (MITM) attacks. Do not use in production.\", r.Name)\n\t}\n\n\t// Validate BaseURL\n\tparsedURL, err := url.ParseRequestURI(r.BaseURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse BaseUrl %v\", err)\n\t}\n\n\tallowedRanges, err := parseCIDRs(r.AllowedIPRanges)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid allowedIpRanges: %w\", err)\n\t}\n\n\tcustomBlocked, err := parseCIDRs(r.CustomBlockedIPRanges)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid customBlockedIpRanges: %w\", err)\n\t}\n\n\tguard := &SSRFGuard{\n\t\tAllowPrivateNetworks: r.AllowPrivateNetworks,\n\t\tAllowedRanges:        allowedRanges,\n\t\tCustomBlocked:        customBlocked,\n\t}\n","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/http/http.go#L99-L135","documentation":"This error occurs when url.ParseRequestURI rejects the configured BaseUrl for the HTTP source. ParseRequestURI is stricter than url.Parse: it requires an absolute URI (scheme + host) for this usage, so values like \"example.com/api\", \"/api\", or strings with spaces/illegal characters fail. The source cannot make any request without a valid base URL.","triggerScenarios":"url.ParseRequestURI(r.BaseURL) returns non-nil err during Initialize: BaseUrl missing the scheme (\"myhost.com\" instead of \"https://myhost.com\"), empty string, relative path, embedded spaces, or otherwise malformed URI.","commonSituations":"Omitting https:// from the configured URL; trailing config typos; pasting a URL with surrounding whitespace/quotes; using a path-only value for internal services.","solutions":["Include the scheme: use \"https://api.example.com\" not \"api.example.com\"","Trim whitespace and stray quotes from the configured value","Verify the full BaseUrl with a quick curl or by parsing it in a scratch Go snippet using url.ParseRequestURI to confirm it passes"],"exampleFix":"// before\nbaseUrl: api.example.com/v1\n// after\nbaseUrl: https://api.example.com/v1","handlingStrategy":"validation","validationCode":"func validBaseURL(s string) bool {\n    u, err := url.ParseRequestURI(strings.TrimSpace(s))\n    return err == nil && (u.Scheme == \"http\" || u.Scheme == \"https\") && u.Host != \"\"\n}","typeGuard":null,"tryCatchPattern":"src, err := cfg.Initialize(ctx, tracer)\nif err != nil && strings.Contains(err.Error(), \"failed to parse BaseUrl\") {\n    log.Fatalf(\"BaseUrl must be an absolute URI with scheme, e.g. https://host: %v\", err)\n}","preventionTips":["Always include http:// or https:// in BaseUrl","Trim whitespace/quotes when editing YAML values","Validate the URL with url.ParseRequestURI before deploying configs"],"tags":["http","configuration","url","validation"],"backgroundTag":"invalid-url-config","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"}