{"record":{"id":"8de5ed5e5a58bacb","repo":"cloudflare/cloudflared","slug":"failed-to-resolve-any-edge-address","errorCode":null,"errorMessage":"failed to resolve any edge address","messagePattern":"failed to resolve any edge address","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"edgediscovery/allregions/regions.go","lineNumber":41,"sourceCode":"\tedgeAddrs, err := EdgeDiscovery(log, RegionalServiceName(region))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(edgeAddrs) < 2 {\n\t\treturn nil, fmt.Errorf(\"expected at least 2 Cloudflare Regions regions, but SRV only returned %v\", len(edgeAddrs))\n\t}\n\treturn &Regions{\n\t\tregion1: NewRegion(edgeAddrs[0], overrideIPVersion),\n\t\tregion2: NewRegion(edgeAddrs[1], overrideIPVersion),\n\t}, nil\n}\n\n// StaticEdge creates a list of edge addresses from the list of hostnames.\n// Mainly used for testing connectivity.\nfunc StaticEdge(hostnames []string, log *zerolog.Logger) (*Regions, error) {\n\tresolved := ResolveAddrs(hostnames, log)\n\tif len(resolved) == 0 {\n\t\treturn nil, fmt.Errorf(\"failed to resolve any edge address\")\n\t}\n\treturn NewNoResolve(resolved), nil\n}\n\n// NewNoResolve doesn't resolve the edge. Instead it just uses the given addresses.\n// You probably only need this for testing.\nfunc NewNoResolve(addrs []*EdgeAddr) *Regions {\n\tregion1 := make([]*EdgeAddr, 0)\n\tregion2 := make([]*EdgeAddr, 0)\n\tfor i, v := range addrs {\n\t\tif i%2 == 0 {\n\t\t\tregion1 = append(region1, v)\n\t\t} else {\n\t\t\tregion2 = append(region2, v)\n\t\t}\n\t}\n\n\treturn &Regions{","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/edgediscovery/allregions/regions.go#L23-L59","documentation":"StaticEdge builds the edge address list directly from user-supplied hostnames (mainly for testing connectivity), resolving each via ResolveAddrs without SRV lookup. This error is thrown when none of the provided hostnames could be resolved to any IP address, so there is no edge address to connect to. It means the entire user-provided hostname list failed DNS resolution.","triggerScenarios":"Calling StaticEdge(hostnames, log) where ResolveAddrs returns an empty slice because every hostname in the list is unresolvable — mistyped hostnames, names absent from DNS, or a resolver that fails for all of them (len(resolved) == 0).","commonSituations":"Typo'd hostnames in --edge or test configuration; using internal hostnames that the machine's resolver cannot see (VPN down, split-horizon DNS); testing in an isolated network with no DNS at all; hostnames that only exist in /etc/hosts on another machine.","solutions":["Check the hostnames for typos and verify each resolves on this machine: 'nslookup <hostname>' (or 'getent hosts <hostname>'); correct or remove the bad entries.","Fix the machine's DNS setup — /etc/resolv.conf, VPN, or corporate resolver — so at least one hostname resolves.","Use literal IPs instead of hostnames when DNS is unavailable, since addresses don't need resolving.","If this was used for connectivity testing, confirm the intended hostnames are the correct Cloudflare edge endpoints (port 7844) reachable from your network."],"exampleFix":"// before\n// edge-addresses = [\"edge1.example.internal\", \"edge2.example.internal\"]  // none resolve\n// after\n// edge-addresses = [\"198.41.192.7:7844\", \"198.41.200.13:7844\"]","handlingStrategy":"validation","validationCode":"func allHostnamesResolve(hostnames []string) error {\n    for _, h := range hostnames {\n        if _, err := net.LookupHost(h); err != nil {\n            return fmt.Errorf(\"hostname %q does not resolve: %w\", h, err)\n        }\n    }\n    return nil\n}\n// call before constructing the static edge config","typeGuard":null,"tryCatchPattern":"regions, err := allregions.StaticEdge(hostnames, log)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to resolve any edge address\") {\n        return fmt.Errorf(\"check --edge hostnames and this machine's DNS: %w\", err)\n    }\n    return err\n}","preventionTips":["Validate every hostname with nslookup/getent hosts on the target machine before putting it in config","Prefer literal IPs in edge-address lists when DNS availability is uncertain","Confirm VPN/split-horizon DNS is up so internal hostnames resolve","Keep the hostname list short and sourced from a reviewed config file, not ad-hoc CLI input"],"tags":["network","dns","hostname-resolution","configuration"],"backgroundTag":"dns-resolution-failed","analyzedSha":"2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f","analyzedAt":"2026-09-06T04:14:33.757Z","contentChangedAt":"2026-09-06T04:14:33.757Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}