{"record":{"id":"bf18e5aef8460865","repo":"goharbor/harbor","slug":"failed-to-parse-the-url-of-registry-v","errorCode":null,"errorMessage":"failed to parse the URL of registry: %v","messagePattern":"failed to parse the URL of registry: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/server/registry/proxy.go","lineNumber":33,"sourceCode":"package registry\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/http/httputil\"\n\t\"net/url\"\n\n\tcommonhttp \"github.com/goharbor/harbor/src/common/http\"\n\t\"github.com/goharbor/harbor/src/lib/config\"\n)\n\nvar proxy = newProxy()\n\nfunc newProxy() http.Handler {\n\tregURL, _ := config.RegistryURL()\n\turl, err := url.Parse(regURL)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"failed to parse the URL of registry: %v\", err))\n\t}\n\tproxy := httputil.NewSingleHostReverseProxy(url)\n\t// The reverse proxy forwards all /v2/ traffic to a single host (the registry),\n\t// so it deserves a dedicated transport with a large per-host idle connection\n\t// pool. Relying on http.DefaultTransport (MaxIdleConnsPerHost=2) closes almost\n\t// every connection after use under high concurrency, piling up TIME_WAIT\n\t// sockets and eventually exhausting ephemeral ports (EADDRNOTAVAIL).\n\topts := []func(*http.Transport){\n\t\tfunc(tr *http.Transport) {\n\t\t\ttr.MaxIdleConns = 1024\n\t\t\ttr.MaxIdleConnsPerHost = 1024\n\t\t},\n\t}\n\tif commonhttp.InternalTLSEnabled() {\n\t\topts = append(opts, commonhttp.WithInternalTLSConfig())\n\t}\n\tproxy.Transport = commonhttp.NewTransport(opts...)\n","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/server/registry/proxy.go#L15-L51","documentation":"Fatal initialization error in the registry reverse proxy setup: the registry URL returned by config.RegistryURL() cannot be parsed by url.Parse, so the single-host reverse proxy for /v2/ traffic cannot be constructed. The package-level proxy is built via init-time newProxy(), so this panic aborts process startup when the registry URL is malformed.","triggerScenarios":"Thrown at src/server/registry/proxy.go:33 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set a valid registry URL (e.g. http://registry:5000) in the Harbor configuration that feeds config.RegistryURL()","Check the panic's underlying parse error for the exact defect (missing scheme, bad host, whitespace)","Restart the affected core/portal component after fixing the configuration"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","contentChangedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}