{"record":{"id":"23a26e4174698dc5","repo":"karatelabs/karate","slug":"chrome-executable-not-found-set-executable-option-karate","errorCode":null,"errorMessage":"chrome executable not found. Set 'executable' option, KARATE_CHROME_EXECUTABLE env var, or install Chrome at: ${defaultPath}","messagePattern":"chrome executable not found\\. Set 'executable' option, KARATE_CHROME_EXECUTABLE env var, or install Chrome at: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"karate-core/src/main/java/io/karatelabs/driver/cdp/CdpLauncher.java","lineNumber":156,"sourceCode":"        }\n        return fetchWebSocketUrl(host, port);\n    }\n\n    private static String resolveExecutable(String configured) {\n        if (configured != null && !configured.isEmpty()) {\n            if (Files.isExecutable(Path.of(configured))) {\n                return configured;\n            }\n            logger.warn(\"configured executable not found: {}\", configured);\n        }\n\n        String defaultPath = getDefaultPath();\n        if (defaultPath != null && Files.isExecutable(Path.of(defaultPath))) {\n            logger.debug(\"using default chrome path: {}\", defaultPath);\n            return defaultPath;\n        }\n\n        throw new RuntimeException(\"chrome executable not found. \" +\n                \"Set 'executable' option, KARATE_CHROME_EXECUTABLE env var, \" +\n                \"or install Chrome at: \" + defaultPath);\n    }\n\n    private static String getDefaultPath() {\n        if (OsUtils.isMac()) {\n            return DEFAULT_PATH_MAC;\n        } else if (OsUtils.isWindows()) {\n            // Prefer 64-bit, fall back to 32-bit\n            if (Files.isRegularFile(Path.of(DEFAULT_PATH_WIN64)) &&\n                    Files.isReadable(Path.of(DEFAULT_PATH_WIN64))) {\n                return DEFAULT_PATH_WIN64;\n            }\n            return DEFAULT_PATH_WIN32;\n        } else if (OsUtils.isLinux()) {\n            return DEFAULT_PATH_LINUX;\n        }\n        return null;","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/driver/cdp/CdpLauncher.java#L138-L174","documentation":"resolveExecutable tries, in order: the configured 'executable' option, the KARATE_CHROME_EXECUTABLE env var, then platform-specific default Chrome install paths. If none exists or is executable, it throws this RuntimeException telling you exactly which knob to set.","triggerScenarios":"Launching the CDP driver on a machine with no Chrome installed at any default path, no env var set, and no 'executable' option in the driver config.","commonSituations":"Fresh CI container or Docker image without a browser; Linux server where Chrome is at a nonstandard path; macOS/Windows where the user deleted or upgraded Chrome and the default path changed; teammates with different OSes sharing one config.","solutions":["Set KARATE_CHROME_EXECUTABLE to the absolute path of your Chrome/Chromium binary","Set the 'executable' option in the karate driver config","Install Chrome (or Chromium) at the platform default location named in the error message","In Docker, install chromium in the image and point executable at /usr/bin/chromium"],"exampleFix":"// before\ndefaults with no executable configured\n// after (karate config)\nconfigured: { type: 'chrome', executable: '/usr/bin/chromium-browser' }","handlingStrategy":"validation","validationCode":"String chrome = System.getenv(\"KARATE_CHROME_EXECUTABLE\");\nif (chrome == null || !new File(chrome).canExecute()) {\n    throw new IllegalStateException(\"set KARATE_CHROME_EXECUTABLE to a runnable chrome binary\");\n}","typeGuard":"boolean chromeAvailable(String path) {\n    return path != null && new File(path).isFile() && new File(path).canExecute();\n}","tryCatchPattern":"try {\n    CdpLauncher.start(options);\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"chrome executable not found\")) {\n        options.setExecutable(\"/usr/bin/chromium-browser\");\n        CdpLauncher.start(options);\n    } else throw e;\n}","preventionTips":["Set KARATE_CHROME_EXECUTABLE in CI images and shell profiles","Install chromium in Docker images used for tests","Check `which google-chrome || which chromium` during environment setup","Keep the 'executable' option explicit in shared configs rather than relying on defaults"],"tags":["chrome","missing-binary","environment","configuration"],"backgroundTag":"file-not-found","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"}