{"record":{"id":"eaa266cbdaf5a3f6","repo":"quarkusio/quarkus","slug":"unsupported-compressor-in-native-mode","errorCode":null,"errorMessage":"Unsupported compressor in native mode","messagePattern":"Unsupported compressor in native mode","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/graal/MongoClientSubstitutions.java","lineNumber":119,"sourceCode":"    private SSLContext getSslContext() {\n        try {\n            return (sslSettings.getContext() == null) ? SSLContext.getDefault() : sslSettings.getContext();\n        } catch (NoSuchAlgorithmException e) {\n            throw new MongoClientException(\"Unable to create default SSLContext\", e);\n        }\n    }\n}\n\n@TargetClass(className = \"com.mongodb.internal.connection.Compressor\")\nfinal class CompressorSubstitute {\n\n}\n\n@TargetClass(InternalStreamConnection.class)\nfinal class InternalStreamConnectionSubstitution {\n    @Substitute\n    private CompressorSubstitute createCompressor(final MongoCompressor mongoCompressor) {\n        throw new UnsupportedOperationException(\"Unsupported compressor in native mode\");\n    }\n}\n\n@TargetClass(UnixSocketChannelStream.class)\n@Delete\nfinal class UnixSocketChannelStreamSubstitution {\n\n}\n\n@TargetClass(ServerAddressHelper.class)\nfinal class ServerAddressHelperSubstitution {\n\n    @Substitute\n    public static ServerAddress createServerAddress(final String host, final int port) {\n        if (host != null && host.endsWith(\".sock\")) {\n            throw new UnsupportedOperationException(\"Unix socket not supported\");\n        } else {\n            return new ServerAddress(host, port);","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/graal/MongoClientSubstitutions.java#L101-L137","documentation":"In native mode, InternalStreamConnection.createCompressor is substituted with a stub that always throws UnsupportedOperationException — compressor creation is not supported in native images. Any negotiated compressor (other than those filtered earlier) triggers this at stream creation time.","triggerScenarios":"Establishing a MongoDB connection in a native executable where the driver's InternalStreamConnection attempts to instantiate a compressor for the wire protocol, typically because compression was negotiated with the server (compressors=zlib) and this substitute is reached.","commonSituations":"Native-image deployment connecting to MongoDB with compression enabled in the connection string; a server that requires compression negotiation; misaligned Quarkus/Mongo driver versions where the substitution is out of date.","solutions":["Disable compression in native mode (remove compressors from quarkus.mongodb config or set none)","Use zlib and verify the Quarkus substitution for zlib is active for your Quarkus version (upgrade Quarkus if driver internals changed)","Run JVM mode where compressors are fully supported"],"exampleFix":"// before\nquarkus.mongodb.connection-string=mongodb://host/db?compressors=zlib\n// after\nquarkus.mongodb.connection-string=mongodb://host/db","handlingStrategy":"validation","validationCode":"if (isNativeImage() && usesCompression(connectionString)) {\n    log.warn(\"MongoDB compression is negotiated but unsupported in native mode; consider disabling compressors\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    stream = internalStreamConnection;\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().contains(\"Unsupported compressor\")) {\n        // reconnect without compressors\n    } else throw e;\n}","preventionTips":["Disable compressors for native-mode deployments unless zlib substitution is verified","Pin Quarkus and mongodb-driver versions tested together","Include a native-mode connectivity integration test in CI"],"tags":["mongodb","native-image","compression","graal"],"backgroundTag":"mongodb-native-image-unsupported-feature","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"}