{"record":{"id":"dbd527e453616a19","repo":"karatelabs/karate","slug":"driver-stop-false-leaving-browser-running-scenario-will-not","errorCode":null,"errorMessage":"driver.stop=false — leaving browser running, scenario will not close it: {}","messagePattern":"driver\\.stop=false — leaving browser running, scenario will not close it: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"karate-core/src/main/java/io/karatelabs/core/ScenarioRuntime.java","lineNumber":2364,"sourceCode":"     */\n    private void closeDriver() {\n        if (driver == null) {\n            return;\n        }\n\n        // Don't close inherited driver - the owner (caller scenario) will close it\n        if (driverInherited) {\n            driver = null;\n            return;\n        }\n\n        // configure driver = { stop: false } — leave the browser running for DOM\n        // inspection. Skips both direct quit() and the pool's release(). Note that\n        // a leaked driver here loses one slot from the pool's accounting; that's\n        // accepted because stop:false is a single-scenario debug flag.\n        try {\n            if (!driver.getOptions().isStop()) {\n                logger.warn(\"driver.stop=false — leaving browser running, scenario will not close it: {}\",\n                        scenario.getName());\n                driver = null;\n                return;\n            }\n        } catch (Exception e) {\n            logger.debug(\"could not read driver options for stop check: {}\", e.getMessage());\n        }\n\n        // Shared-scope called feature: propagate the driver up to the caller scenario\n        // immediately so sibling scenarios in this same called feature can inherit it\n        // via the normal inheritDriverFromCaller path. Without this, scenario N+1 in a\n        // multi-scenario called feature can't see scenario N's driver — it falls\n        // through to PooledDriverProvider.acquire() and deadlocks if the pool is full.\n        if (featureRuntime != null && featureRuntime.isSharedScope()\n                && featureRuntime.getCallerScenario() != null) {\n            featureRuntime.getCallerScenario().setDriverFromCallee(this);\n            driver = null;\n            return;","sourceCodeStart":2346,"sourceCodeEnd":2382,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/core/ScenarioRuntime.java#L2346-L2382","documentation":"When tearing down a scenario that has a driver, Karate checks `driver.getOptions().isStop()`. If stop is false (from `configure driver = { stop: false }`), Karate deliberately leaves the browser running, drops its driver reference, and logs this warning. The scenario will not close the browser, and one pool slot's accounting is lost.","triggerScenarios":"Scenario end (or driver release path) reached while the driver options carry `stop=false`, e.g. after `configure driver = { stop: false }` was set during the scenario.","commonSituations":"Post-failure DOM inspection sessions; leaked browsers accumulating after debug runs; confusing 'browser still open' states on CI agents.","solutions":["Remove `stop:false` so normal quit/release teardown resumes","Manually kill leftover browser/driver processes after debug sessions","Only use stop:false in throwaway local debug runs, never on shared CI nodes","Restart the driver pool / JVM if pool accounting drifts"],"exampleFix":"// before\nconfigure driver = { type: 'chromedriver', stop: false }\n// after\nconfigure driver = { type: 'chromedriver' }","handlingStrategy":"fallback","validationCode":"// Guard configs that may carry stop:false:\nif (karate.get('driverConfig') && karate.get('driverConfig').stop === false) { karate.log('browser will leak; debug only'); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remove stop:false before CI runs","Automate orphan-browser cleanup on agents","Use a dedicated debug-only feature file"],"tags":["karate","driver","teardown","browser-leak"],"backgroundTag":"resource-leak","analyzedSha":"a22eb90246d958d15a47bf436693d0121ad2812d","analyzedAt":"2026-09-12T09:01:00.220Z","contentChangedAt":"2026-09-12T09:01:00.220Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}