{"record":{"id":"82ed56cd0715eeb3","repo":"glanceapp/glance","slug":"creating-request-w","errorCode":null,"errorMessage":"creating request: %w","messagePattern":"creating request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/glance/widget-docker-containers.go","lineNumber":322,"sourceCode":"\t} else {\n\t\thostname = \"docker\"\n\t\tclient = &http.Client{\n\t\t\tTransport: &http.Transport{\n\t\t\t\tDialContext: func(_ context.Context, _, _ string) (net.Conn, error) {\n\t\t\t\t\treturn net.Dial(\"unix\", source)\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n\n\n\tfetchAll := ternary(runningOnly, \"false\", \"true\")\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\trequest, err := http.NewRequestWithContext(ctx, \"GET\", \"http://\"+hostname+\"/containers/json?all=\"+fetchAll, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating request: %w\", err)\n\t}\n\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"sending request to socket: %w\", err)\n\t}\n\tdefer response.Body.Close()\n\n\tif response.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"non-200 response status: %s\", response.Status)\n\t}\n\n\tvar containers []dockerContainerJsonResponse\n\tif err := json.NewDecoder(response.Body).Decode(&containers); err != nil {\n\t\treturn nil, fmt.Errorf(\"decoding response: %w\", err)\n\t}\n\n\tfor i := range containers {","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/glanceapp/glance/blob/91324e8de762702e97b0ac5c8e36271d644d8642/internal/glance/widget-docker-containers.go#L304-L340","documentation":"http.NewRequestWithContext failed while constructing GET http://<hostname>/containers/json?all=<true|false>. Because the URL is assembled from a validated host:port plus a fixed path, this is nearly unreachable — it signals the hostname derived earlier contains characters that break URL parsing.","triggerScenarios":"hostname contains a space, control character, or invalid bracket syntax (e.g. IPv6 literal not bracketed) coming from a tcp:// source URL.","commonSituations":"IPv6 remote Docker host written without brackets; garbage host from a mis-templated configuration.","solutions":["Validate the tcp:// source host (no spaces; bracket IPv6 literals as [::1]:2375)","Use an IPv4 address or DNS name for the remote Docker host"],"exampleFix":"# before\n  host: tcp://::1:2375\n# after\n  host: \"tcp://[::1]:2375\"","handlingStrategy":"validation","validationCode":"if net.ParseIP(hostname) == nil && strings.ContainsAny(hostname, \" \\t\") {\n    return fmt.Errorf(\"invalid docker hostname %q\", hostname)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use DNS names or bracketed IPv6 literals for remote Docker hosts","Reject hostnames containing whitespace at config load time"],"tags":["docker","url","ipv6","unreachable"],"backgroundTag":null,"analyzedSha":"91324e8de762702e97b0ac5c8e36271d644d8642","analyzedAt":"2026-08-15T14:12:54.279Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}