{"record":{"id":"fe930c835842653d","repo":"testcontainers/testcontainers-java","slug":"unexpected-scheme-s","errorCode":null,"errorMessage":"Unexpected scheme %s","messagePattern":"Unexpected scheme (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/testcontainers/dockerclient/DockerClientProviderStrategy.java","lineNumber":198,"sourceCode":"                }\n                socketProvider = socketFactory::createSocket;\n                socketAddress = new InetSocketAddress(dockerHost.getHost(), dockerHost.getPort());\n                break;\n            case \"unix\":\n            case \"npipe\":\n                if (!new File(dockerHost.getPath()).exists()) {\n                    log.debug(\"DOCKER_HOST socket file '{}' does not exist\", dockerHost.getPath());\n                    return false;\n                }\n                socketProvider =\n                    () -> {\n                        switch (dockerHost.getScheme()) {\n                            case \"unix\":\n                                return UnixSocket.get(dockerHost.getPath());\n                            case \"npipe\":\n                                return new NamedPipeSocket(dockerHost.getPath());\n                            default:\n                                throw new IllegalStateException(\"Unexpected scheme \" + dockerHost.getScheme());\n                        }\n                    };\n                socketAddress = new InetSocketAddress(\"localhost\", 2375);\n                break;\n            default:\n                log.warn(\"Unknown DOCKER_HOST scheme {}, skipping the strategy test...\", dockerHost.getScheme());\n                return true;\n        }\n\n        try (Socket socket = socketProvider.call()) {\n            Awaitility\n                .await()\n                .atMost(TestcontainersConfiguration.getInstance().getClientPingTimeout(), TimeUnit.SECONDS) // timeout after configured duration\n                .pollInterval(Duration.ofMillis(200)) // check state every 200ms\n                .pollDelay(Duration.ofSeconds(0)) // start checking immediately\n                .untilAsserted(() -> socket.connect(socketAddress));\n            return true;\n        } catch (Exception e) {","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/core/src/main/java/org/testcontainers/dockerclient/DockerClientProviderStrategy.java#L180-L216","documentation":"DockerClientProviderStrategy.test() validates a DOCKER_HOST by constructing a socket appropriate to its scheme. The code handles 'unix' and 'npipe' (plus tcp/localhost earlier in the switch); any other scheme (e.g. http://, https://, ftp://, or a typo) reaches the default branch and throws this IllegalStateException, failing the strategy's self-test.","triggerScenarios":"DOCKER_HOST set to a value whose URI scheme is not one of tcp://, unix://, npipe:// — for example DOCKER_HOST=http://localhost:2375 or a malformed/misspelled scheme.","commonSituations":"Users copying docker CLI -H syntax (tcp://) incorrectly or using an http:// URL; DOCKER_HOST inherited from CI with a proxy-style URL; typos like 'unix:/' or quoted values with stray characters.","solutions":["Fix DOCKER_HOST to a supported scheme: tcp://host:2375, unix:///var/run/docker.sock, or npipe:////./pipe/docker_engine","Unset DOCKER_HOST to let Testcontainers auto-detect the local Docker environment","Verify with `echo $DOCKER_HOST` / `docker context ls` what the client is actually pointed at"],"exampleFix":"// before\nDOCKER_HOST=http://localhost:2375\n// after\nDOCKER_HOST=tcp://localhost:2375\n# or simply unset DOCKER_HOST and rely on auto-detection","handlingStrategy":"validation","validationCode":"String dh = System.getenv(\"DOCKER_HOST\");\nif (dh != null) {\n    String scheme = java.net.URI.create(dh).getScheme();\n    if (scheme == null || !(scheme.equals(\"tcp\") || scheme.equals(\"unix\") || scheme.equals(\"npipe\") || scheme.equals(\"http\") || scheme.equals(\"https\"))) {\n        throw new IllegalStateException(\"Unsupported DOCKER_HOST scheme: \" + scheme + \" in \" + dh);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    DockerClientFactory.instance().client();\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"Unexpected scheme\")) {\n        // unset or fix DOCKER_HOST and retry\n    }\n    throw e;\n}","preventionTips":["Use only tcp://, unix://, or npipe:// schemes for DOCKER_HOST","Prefer unsetting DOCKER_HOST and letting Testcontainers auto-detect","Validate DOCKER_HOST in CI setup steps before running tests"],"tags":["docker","docker-host","configuration","scheme","testcontainers"],"backgroundTag":"invalid-url-format","analyzedSha":"8e549514e3f01c57d70546fbb8599d138f3903e5","analyzedAt":"2026-09-12T14:56:41.227Z","contentChangedAt":"2026-09-12T14:56:41.227Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}