{"record":{"id":"bddc8d709b430ba6","repo":"caddyserver/caddy","slug":"server-block-d-key-d-s-determining-listener","errorCode":null,"errorMessage":"server block %d, key %d (%s): determining listener address: %v","messagePattern":"server block (.+?), key (.+?) \\((.+?)\\): determining listener address: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"caddyconfig/httpcaddyfile/addresses.go","lineNumber":110,"sourceCode":"\t\t// implied by the server block to the keys of the server block which\n\t\t// will be served by them; this has the effect of treating each\n\t\t// key of a server block as its own, but without having to repeat its\n\t\t// contents in cases where multiple keys really can be served together\n\t\taddrToProtocolToKeyWithParsedKeys := map[string]map[string][]keyWithParsedKey{}\n\t\tfor j, key := range sblock.block.Keys {\n\t\t\tparsedKey, err := ParseAddress(key.Text)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing key: %v\", err)\n\t\t\t}\n\t\t\tparsedKey = parsedKey.Normalize()\n\n\t\t\t// a key can have multiple listener addresses if there are multiple\n\t\t\t// arguments to the 'bind' directive (although they will all have\n\t\t\t// the same port, since the port is defined by the key or is implicit\n\t\t\t// through automatic HTTPS)\n\t\t\tlisteners, err := st.listenersForServerBlockAddress(sblock, parsedKey, options)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"server block %d, key %d (%s): determining listener address: %v\", i, j, key.Text, err)\n\t\t\t}\n\n\t\t\t// associate this key with its protocols and each listener address served with them\n\t\t\tkwpk := keyWithParsedKey{key, parsedKey}\n\t\t\tfor addr, protocols := range listeners {\n\t\t\t\tprotocolToKeyWithParsedKeys, ok := addrToProtocolToKeyWithParsedKeys[addr]\n\t\t\t\tif !ok {\n\t\t\t\t\tprotocolToKeyWithParsedKeys = map[string][]keyWithParsedKey{}\n\t\t\t\t\taddrToProtocolToKeyWithParsedKeys[addr] = protocolToKeyWithParsedKeys\n\t\t\t\t}\n\n\t\t\t\t// an empty protocol indicates the default, a nil or empty value in the ListenProtocols array\n\t\t\t\tif len(protocols) == 0 {\n\t\t\t\t\tprotocols[\"\"] = struct{}{}\n\t\t\t\t}\n\t\t\t\tfor prot := range protocols {\n\t\t\t\t\tprotocolToKeyWithParsedKeys[prot] = append(\n\t\t\t\t\t\tprotocolToKeyWithParsedKeys[prot],","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/caddyconfig/httpcaddyfile/addresses.go#L92-L128","documentation":"After a site key parsed successfully, listenersForServerBlockAddress failed for it: the combination of the key's scheme/port and the block's bind addresses/protocols produced an invalid listener setup. The message identifies the exact server block index, key index, and key text.","triggerScenarios":"Causes include ws/wss schemes, scheme/port convention violations (https on the http port or vice versa), an unsupported scheme, a bind address that fails SplitNetworkAddress/ParseNetworkAddress, or bind protocols invalid for the address.","commonSituations":"Site label like 'http://example.com:443' (convention violation), 'ws://' keys, or a bind directive with a malformed address such as 'bind tcp/' or an unparseable network prefix.","solutions":["Use the key text in the message to find the block, then read the wrapped error: it will be one of the scheme/port/bind errors from listenersForServerBlockAddress","For convention violations, align scheme and port (http with 80/http_port, https with 443/https_port)","Replace ws:// or wss:// keys with http:// or https:// — WebSocket works over both in Caddy","Fix or remove the bind directive value mentioned in the wrapped error"],"exampleFix":"# before\nhttp://example.com:443 {\n}\n# after\nhttps://example.com:443 {\n}","handlingStrategy":"validation","validationCode":"addr, err := httpcaddyfile.ParseAddress(key)\nif err != nil { return err }\naddr = addr.Normalize()\nswitch addr.Scheme {\ncase \"ws\", \"wss\", \"ftp\", \"tcp\":\n    return fmt.Errorf(\"scheme %q not allowed in site address\", addr.Scheme)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Write proxy upstream URLs in reverse_proxy, not in site labels","Keep bind addresses bare (no scheme)","Use `caddy adapt` to validate the full scheme/port/bind combination"],"tags":["caddyfile","site-address","bind","listener"],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}