{"record":{"id":"87d81d9c2139949e","repo":"amir20/dozzle","slug":"invalid-connection-string-s","errorCode":null,"errorMessage":"invalid connection string: %s","messagePattern":"invalid connection string: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/container/host.go","lineNumber":45,"sourceCode":"\tType          string   `json:\"type\"`\n\tAvailable     bool     `json:\"available\"`\n\tSwarm         bool     `json:\"-\"`\n\t// SwarmClusterID identifies the swarm this node belongs to, empty outside\n\t// a swarm. Every node of one swarm reports the same value, which is what\n\t// lets Dozzle Cloud tell \"one swarm, N replicas\" apart from one API key\n\t// reused across unrelated deployments.\n\tSwarmClusterID string `json:\"-\"`\n\tGroup          string `json:\"group,omitempty\"`\n}\n\nfunc (h Host) String() string {\n\treturn fmt.Sprintf(\"ID: %s, Endpoint: %s, nCPU: %d, memTotal: %d\", h.ID, h.Endpoint, h.NCPU, h.MemTotal)\n}\n\nfunc ParseConnection(connection string) (Host, error) {\n\tparts := strings.Split(connection, \"|\")\n\tif len(parts) > 3 || parts[0] == \"\" {\n\t\treturn Host{}, fmt.Errorf(\"invalid connection string: %s\", connection)\n\t}\n\n\tremoteUrl, err := url.Parse(parts[0])\n\tif err != nil {\n\t\treturn Host{}, err\n\t}\n\n\tname := remoteUrl.Hostname()\n\tif len(parts) >= 2 && parts[1] != \"\" {\n\t\tname = parts[1]\n\t}\n\n\tgroup := \"\"\n\tif len(parts) == 3 {\n\t\tgroup = parts[2]\n\t}\n\n\tbasePath, err := filepath.Abs(\"./certs\")","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/amir20/dozzle/blob/d9463cbe21874e44ab79db6fa63e746ca7d22928/internal/container/host.go#L27-L63","documentation":"ParseConnection parses a multi-host connection string of the form 'url|name[|cert]', splitting on '|'. If the string has more than 3 parts or an empty URL part, it returns 'invalid connection string' with the original input. This guards the remote-host configuration format.","triggerScenarios":"CreateMultiHostService parses a DOZZLE_REMOTE_HOST / remote hosts entry that contains more than two '|' separators or an empty first segment (empty string, leading '|', or '||').","commonSituations":"Environment variable with a trailing pipe; TCP endpoint mistakenly wrapped with extra metadata after pipes; empty entries in a comma/space-separated remote host list; yml config value left as '||'.","solutions":["Format the connection string as 'tcp://host:port|name' (optional third '|cert' segment) with at most two pipes","Remove stray or trailing '|' characters and empty segments from the env/config value","Trim whitespace/empty entries out of the remote hosts list before passing to Dozzle"],"exampleFix":"// before\nDOZZLE_REMOTE_HOST=\"tcp://1.2.3.4:2375|remote|\"\n// after\nDOZZLE_REMOTE_HOST=\"tcp://1.2.3.4:2375|remote\"","handlingStrategy":"validation","validationCode":"func validConnection(s string) bool {\n  parts := strings.Split(s, \"|\")\n  return len(parts) <= 3 && parts[0] != \"\"\n}\n// check before setting DOZZLE_REMOTE_HOST","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the 'url|name[|cert]' format with no extra pipes","Trim whitespace and drop empty entries from remote host lists","Test the remote URL is reachable before adding the host"],"tags":["docker","config","multi-host"],"backgroundTag":"invalid-argument-format","analyzedSha":"d9463cbe21874e44ab79db6fa63e746ca7d22928","analyzedAt":"2026-09-07T10:08:55.855Z","contentChangedAt":"2026-09-07T10:08:55.855Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}