{"record":{"id":"9d6b7acc77b4cf67","repo":"louislam/uptime-kuma","slug":"dns-lookup-returned-no-addresses","errorCode":null,"errorMessage":"DNS lookup returned no addresses","messagePattern":"DNS lookup returned no addresses","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/monitor-types/steam.js","lineNumber":122,"sourceCode":"    /**\n     * Resolves hostnames before passing them to Steam's addr filter.\n     * @param {string} hostname Steam server hostname or IP address.\n     * @returns {Promise<string>} IP address accepted by the Steam API.\n     * @throws {Error} When the hostname cannot be resolved.\n     */\n    async resolveSteamHostname(hostname) {\n        if (net.isIP(hostname)) {\n            return hostname;\n        }\n\n        try {\n            const lookupResult = await this.lookup(hostname, { all: true });\n            const addresses = Array.isArray(lookupResult) ? lookupResult : [lookupResult];\n            const ipv4Address = addresses.find(({ address }) => net.isIP(address) === 4);\n            const resolvedAddress = ipv4Address?.address || addresses[0]?.address;\n\n            if (!resolvedAddress) {\n                throw new Error(\"DNS lookup returned no addresses\");\n            }\n\n            return resolvedAddress;\n        } catch (error) {\n            throw new Error(`Unable to resolve Steam server hostname \"${hostname}\": ${error.message}`);\n        }\n    }\n}\n\nmodule.exports = {\n    SteamMonitorType,\n};\n","sourceCodeStart":104,"sourceCodeEnd":135,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/monitor-types/steam.js#L104-L135","documentation":"Thrown inside resolveSteamHostname() when dns.lookup resolved without throwing but produced no usable address. The code finds the first IPv4 address (preferred) and falls back to addresses[0].address; if both are undefined, no address can be handed to the Steam addr filter. This is a defensive guard against an empty/oddly-shaped lookup result.","triggerScenarios":"Produced when the lookup returns an array whose entries lack an 'address' field, or returns an empty array (some custom lookup stubs or DNS configurations can do this), and net.isIP did not short-circuit because the input was a hostname rather than a literal IP.","commonSituations":"Custom DNS resolver returning malformed records; hostname exists only as a CNAME loop with no A/AAAA; transient empty response from a flaky resolver; test stub providing a lookup result missing the expected 'address' property; IPv6-only host where the find() for IPv4 fails and the fallback entry shape differs.","solutions":["Resolve the hostname with 'dig' or 'nslookup' on the Uptime-Kuma host and confirm at least one A or AAAA record is returned.","If the server only has IPv6, ensure the resolver returns AAAA records with the expected shape (address field).","Replace the monitor hostname with the server's literal IP address to bypass DNS entirely.","In tests, ensure the injected lookup returns objects shaped like { address: '1.2.3.4', family: 4 }."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function pickAddress(lookupResult) {\n  const addrs = Array.isArray(lookupResult) ? lookupResult : [lookupResult];\n  const ipv4 = addrs.find(a => net.isIP(a.address) === 4);\n  const chosen = ipv4?.address || addrs[0]?.address;\n  if (!chosen) throw new Error(\"DNS lookup returned no addresses\");\n  return chosen;\n}","typeGuard":"function hasUsableAddress(entries) { return Array.isArray(entries) && entries.some(e => e && typeof e.address === \"string\" && net.isIP(e.address)); }","tryCatchPattern":"const resolved = pickAddress(await this.lookup(hostname, { all: true }));","preventionTips":["Prefer literal IPs for Steam monitors to avoid DNS edge cases.","Ensure your resolver returns well-formed { address, family } records.","In tests, shape stub results to match node:dns output."],"tags":["steam","dns","resolution","ipv4"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}