{"record":{"id":"be3a6c010692b2b3","repo":"Tencent/WeKnora","slug":"invalid-searxng-base-url-scheme-s","errorCode":null,"errorMessage":"invalid SearXNG base_url scheme: %s","messagePattern":"invalid SearXNG base_url scheme: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/infrastructure/web_search/searxng.go","lineNumber":50,"sourceCode":"\tbaseURL          string\n\tlastUnresponsive [][]string\n}\n\n// ValidateSearxngBaseURL validates a SearXNG instance URL: must be a non-empty,\n// absolute http(s) URL, and must pass the SSRF whitelist check. Shared between\n// the service-layer parameter validation and the provider constructor so that\n// \"save\" and \"use\" never disagree.\nfunc ValidateSearxngBaseURL(rawURL string) error {\n\tbase := strings.TrimSpace(rawURL)\n\tif base == \"\" {\n\t\treturn fmt.Errorf(\"base_url is required for SearXNG provider\")\n\t}\n\tparsed, err := url.Parse(base)\n\tif err != nil || parsed.Scheme == \"\" || parsed.Host == \"\" {\n\t\treturn fmt.Errorf(\"invalid SearXNG base_url: must be an absolute http(s) URL\")\n\t}\n\tif parsed.Scheme != \"http\" && parsed.Scheme != \"https\" {\n\t\treturn fmt.Errorf(\"invalid SearXNG base_url scheme: %s\", parsed.Scheme)\n\t}\n\tif parsed.RawQuery != \"\" || parsed.Fragment != \"\" {\n\t\treturn fmt.Errorf(\"invalid SearXNG base_url: must not contain query or fragment\")\n\t}\n\tif err := utils.ValidateURLForSSRF(base); err != nil {\n\t\treturn fmt.Errorf(\"invalid SearXNG base_url: %w\", err)\n\t}\n\treturn nil\n}\n\n// NewSearxngProvider builds a SearXNG provider from tenant parameters.\nfunc NewSearxngProvider(params types.WebSearchProviderParameters) (interfaces.WebSearchProvider, error) {\n\tbase := strings.TrimSpace(params.BaseURL)\n\tif err := ValidateSearxngBaseURL(base); err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient, err := NewSearchHTTPClient(defaultSearxngTimeout, params.ProxyURL)","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/infrastructure/web_search/searxng.go#L32-L68","documentation":"The SearXNG base_url is absolute but its scheme is neither http nor https (e.g. ftp://, file://, socks5://). ValidateSearxngBaseURL restricts schemes to the two web schemes since the provider issues HTTP requests to the instance.","triggerScenarios":"NewSearxngProvider or save validation with base_url such as \"ftp://searx.example.com\" or \"file:///srv/searxng\".","commonSituations":"Users pasting a SOCKS proxy value into base_url by mistake, config generators emitting unix/https typos like \"httpss://\", accidental scheme corruption.","solutions":["Change the scheme to https (preferred) or http","Verify the instance actually serves plain HTTP(S)","Do not put proxy schemes here; configure proxies via proxy_url instead","Re-check for typos like \"htps://\" or \"https//\" (missing colon)"],"exampleFix":"// before\nbaseURL := \"socks5://searx.example.com\"\n// after\nbaseURL := \"https://searx.example.com\"","handlingStrategy":"validation","validationCode":"u, err := url.Parse(baseURL)\nif err == nil && u.Scheme != \"http\" && u.Scheme != \"https\" {\n    return fmt.Errorf(\"base_url scheme must be http or https, got %q\", u.Scheme)\n}","typeGuard":null,"tryCatchPattern":"if err := web_search.ValidateSearxngBaseURL(cfg.BaseURL); err != nil {\n    if strings.Contains(err.Error(), \"scheme\") {\n        return fmt.Errorf(\"base_url must start with http:// or https://\")\n    }\n    return err\n}","preventionTips":["Restrict scheme choices to http/https in any config UI dropdown","Keep proxy settings (socks5 etc.) in proxy_url, not base_url","Check for scheme typos before saving (htps://, https//)","Validate at config load with the same rules the provider uses"],"tags":["url","validation","searxng","scheme"],"backgroundTag":"invalid-url-format","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}