{"record":{"id":"2402680dc7fc7766","repo":"quarkusio/quarkus","slug":"unknown-dns-record-type","errorCode":null,"errorMessage":"Unknown DNS record type: ","messagePattern":"Unknown DNS record type: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"warning","filePath":"extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/dns/MongoDnsClient.java","lineNumber":99,"sourceCode":"            try (Stream<String> lines = Files.lines(conf)) {\n                nameServers = lines\n                        .filter(line -> line.startsWith(\"nameserver\"))\n                        .map(line -> line.split(\" \")[1])\n                        .collect(Collectors.toList());\n            } catch (IOException | ArrayIndexOutOfBoundsException e) {\n                log.info(\"Unable to read the /etc/resolv.conf file\", e);\n            }\n        }\n        return nameServers;\n    }\n\n    @Override\n    public List<String> getResourceRecordData(String name, String type) throws DnsException {\n        log.debugf(\"Resolving DNS record for name: %s and type: %s\", name, type);\n        return switch (type) {\n            case \"SRV\" -> resolveSrvRequest(name);\n            case \"TXT\" -> resolveTxtRequest(name);\n            default -> throw new IllegalArgumentException(\"Unknown DNS record type: \" + type);\n        };\n    }\n\n    /*\n     * The format of SRV record is\n     * priority weight port target.\n     * e.g.\n     * 0 5 5060 example.com.\n     * The priority and weight are ignored, and we just concatenate the host (after removing the ending '.') and port with a\n     * ':' in between, as expected by ServerAddress.\n     * It's required that the srvHost has at least three parts (e.g. foo.bar.baz) and that all of the resolved hosts have a\n     * parent\n     * domain equal to the domain of the srvHost.\n     */\n    private List<String> resolveSrvRequest(final String srvHost) {\n        List<String> hosts = new ArrayList<>();\n        Duration timeout = mongoConfig.dnsLookupTimeout();\n","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/dns/MongoDnsClient.java#L81-L117","documentation":"MongoDnsClient implements the driver's DnsClient SPI and resolves only SRV and TXT records, which are the only record types mongodb+srv:// discovery requires. Any other record type string passed to getResourceRecordData is rejected with this IllegalArgumentException.","triggerScenarios":"The MongoDB driver's DNS resolution layer (or custom code using MongoDnsClient) requests a record type other than \"SRV\" or \"TXT\" from getResourceRecordData(name, type).","commonSituations":"Driver version behavior requesting A/AAAA records through this client; custom code calling the DnsClient SPI directly with the wrong type string; lowercase or padded type strings like \"srv\" instead of \"SRV\".","solutions":["Only request \"SRV\" or \"TXT\" record types from this client","Check the type argument's exact casing — the switch is case-sensitive","If you need A/AAAA resolution, use the standard DNS client (Vertx DnsClient) instead of the Mongo DnsClient SPI","Ensure you're on matching versions of quarkus-mongodb-client and the driver so the SPI contract is honored"],"exampleFix":"// before\ndnsClient.getResourceRecordData(host, \"srv\");\n// after\ndnsClient.getResourceRecordData(host, \"SRV\");","handlingStrategy":"type-guard","validationCode":"// Only pass supported record types\nif (!\"SRV\".equals(type) && !\"TXT\".equals(type)) {\n    throw new IllegalArgumentException(\"MongoDnsClient supports only SRV/TXT, got: \" + type);\n}","typeGuard":"boolean isSupportedRecordType(String type) {\n    return \"SRV\".equals(type) || \"TXT\".equals(type);\n}","tryCatchPattern":"try {\n    records = dnsClient.getResourceRecordData(name, type);\n} catch (IllegalArgumentException e) {\n    log.warn(\"Unsupported record type requested: \" + type);\n    records = List.of();\n}","preventionTips":["Request only SRV and TXT from the Mongo DnsClient SPI","Keep type strings uppercase constants","Use a general-purpose DNS client for other record types"],"tags":["mongodb","dns","srv"],"backgroundTag":"dns-unsupported-record-type","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}