{"record":{"id":"4c3dbd4b5f366c72","repo":"karatelabs/karate","slug":"pool-size-but-websocketurl-names-a-single-page-all-slots","errorCode":null,"errorMessage":"pool size {} but webSocketUrl names a single page — all slots will drive the SAME tab. Pass a browser-level endpoint (see /json/version) for isolated slots: {}","messagePattern":"pool size (.+?) but webSocketUrl names a single page — all slots will drive the SAME tab\\. Pass a browser-level endpoint \\(see /json/version\\) for isolated slots: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"karate-core/src/main/java/io/karatelabs/driver/PooledDriverProvider.java","lineNumber":439,"sourceCode":"     * tab — that is inherent to the request, not something this method can fix.\n     * </p>\n     */\n    protected Driver createDriver(Map<String, Object> config) {\n        String type = (String) config.getOrDefault(\"type\", \"chrome\");\n        if (W3cBrowserType.isW3cType(type)) {\n            return W3cDriver.start(config);\n        }\n        // CDP (default)\n        CdpDriverOptions options = CdpDriverOptions.fromMap(config);\n        String wsUrl = options.getWebSocketUrl();\n        if (wsUrl == null || wsUrl.isEmpty()) {\n            return CdpDriver.start(options);\n        }\n        if (wsUrl.contains(\"/devtools/browser/\")) {\n            return CdpDriver.connectNewContext(wsUrl, options);\n        }\n        if (poolSize > 1) {\n            logger.warn(\"pool size {} but webSocketUrl names a single page — all slots will drive the SAME tab.\"\n                    + \" Pass a browser-level endpoint (see /json/version) for isolated slots: {}\", poolSize, wsUrl);\n        }\n        return CdpDriver.connect(wsUrl, options);\n    }\n\n    private void closeDriverQuietly(Driver driver) {\n        try {\n            if (!driver.isTerminated()) {\n                driver.quit();\n            }\n        } catch (Exception e) {\n            logger.warn(\"Error closing driver: {}\", e.getMessage());\n        }\n    }\n\n    /**\n     * Get current pool size (may be -1 if not yet initialized).\n     */","sourceCodeStart":421,"sourceCodeEnd":457,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/driver/PooledDriverProvider.java#L421-L457","documentation":"When createDriver() is given a page-level webSocketUrl (does not contain /devtools/browser/) while poolSize > 1, every pooled driver connects to the SAME tab, so parallel scenarios will interfere. The provider logs this warning and falls back to CdpDriver.connect() on that single page instead of connectNewContext().","triggerScenarios":"Configuring karate with webSocketUrl pointing at a page target from /json/list or /json (contains /devtools/page/) instead of the browser endpoint from /json/version, with poolSize > 1.","commonSituations":"Copy-pasting a debug ws URL from a single Chrome session; using connectToChrome style config for pooled runs; mixing CDP connect examples with the pool feature.","solutions":["Use the browser-level webSocketUrl from http://host:port/json/version (contains /devtools/browser/) so each slot gets connectNewContext() and an isolated context","Set poolSize to 1 if you intentionally share a single page","Drop the explicit webSocketUrl and let Karate launch the browser itself for pooled runs"],"exampleFix":"// before\nwebSocketUrl: 'ws://localhost:9222/devtools/page/ABC123'\npoolSize: 4\n// after\nwebSocketUrl: 'ws://localhost:9222/devtools/browser/GUID-456'\npoolSize: 4","handlingStrategy":"validation","validationCode":"String ws = options.getWebSocketUrl();\nif (ws != null && poolSize > 1 && !ws.contains(\"/devtools/browser/\")) {\n    throw new IllegalArgumentException(\n        \"webSocketUrl must be a browser-level endpoint (/devtools/browser/) when poolSize > 1: \" + ws);\n}","typeGuard":"boolean isBrowserLevel = ws -> ws != null && ws.contains(\"/devtools/browser/\");","tryCatchPattern":null,"preventionTips":["Copy webSocketUrl from /json/version, never /json (page list)","Keep poolSize 1 only when intentionally sharing one tab","Prefer letting Karate launch the browser for pooled runs"],"tags":["cdp","websocketurl","parallel-execution","misconfiguration"],"backgroundTag":"invalid-config-value","analyzedSha":"a22eb90246d958d15a47bf436693d0121ad2812d","analyzedAt":"2026-09-12T09:01:00.220Z","contentChangedAt":"2026-09-12T09:01:00.220Z","schemaVersion":2},"datasetVersion":"2026-09-16T19:17:19.609Z"}