{"record":{"id":"932677d39086c8b3","repo":"karatelabs/karate","slug":"unknown-w3c-driver-type-type","errorCode":null,"errorMessage":"Unknown W3C driver type: \" + type","messagePattern":"Unknown W3C driver type: \" \\+ type","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"karate-core/src/main/java/io/karatelabs/driver/w3c/W3cDriverOptions.java","lineNumber":71,"sourceCode":"    private final PageLoadStrategy pageLoadStrategy;\n    private final String scope;\n    private final boolean stop;\n\n    // W3C-specific\n    private final String webDriverUrl;\n    private final Map<String, Object> webDriverSession;\n    private final Map<String, Object> capabilities;\n    private final boolean start;\n    private final String executable;\n    private final int port;\n    private final List<String> addOptions;\n\n    @SuppressWarnings(\"unchecked\")\n    private W3cDriverOptions(Map<String, Object> map) {\n        String type = (String) map.getOrDefault(\"type\", \"chromedriver\");\n        this.browserType = W3cBrowserType.fromType(type);\n        if (this.browserType == null) {\n            throw new IllegalArgumentException(\"Unknown W3C driver type: \" + type);\n        }\n\n        this.timeout = toInt(map.get(\"timeout\"), 30000);\n        this.retryCount = toInt(map.get(\"retryCount\"), 3);\n        this.retryInterval = toInt(map.get(\"retryInterval\"), 500);\n        this.headless = toBool(map.get(\"headless\"), false);\n        this.screenshotOnFailure = toBool(map.get(\"screenshotOnFailure\"), true);\n        this.highlight = toBool(map.get(\"highlight\"), false);\n        this.highlightDuration = toInt(map.get(\"highlightDuration\"), 3000);\n        this.pageLoadStrategy = PageLoadStrategy.DOMCONTENT_AND_FRAMES;\n        this.scope = (String) map.getOrDefault(\"scope\", \"scenario\");\n        this.stop = toBool(map.get(\"stop\"), true);\n\n        this.webDriverUrl = (String) map.get(\"webDriverUrl\");\n        this.webDriverSession = (Map<String, Object>) map.get(\"webDriverSession\");\n        this.capabilities = (Map<String, Object>) map.get(\"capabilities\");\n        this.start = toBool(map.get(\"start\"), true);\n        this.executable = (String) map.get(\"executable\");","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/driver/w3c/W3cDriverOptions.java#L53-L89","documentation":"W3cDriverOptions validates the configured `type` against the known W3cBrowserType enum and throws IllegalArgumentException 'Unknown W3C driver type: <type>' when the value is not recognized. It is a configuration-time validation so bad driver types fail fast before any process is launched.","triggerScenarios":"Constructing W3cDriverOptions from a map (driver config in karate-config.js or DriverOptions) with `type` set to a value not in W3cBrowserType, or with a misspelling/case mismatch like 'ChromeDriver' / 'firefox-driver'.","commonSituations":"Typo in karate-config.js `type` field; copying config from CDP-based Karate where type names differ; introducing a new browser type with an outdated Karate version that lacks it.","solutions":["Set `type` to a supported value (e.g. 'chromedriver', 'geckodriver' — check W3cBrowserType.fromType for exact strings)","Check spelling/case of the type string in the driver config map","Upgrade Karate if the browser you need was added in a newer W3cBrowserType"],"exampleFix":"// before (karate-config.js)\nkarate.configure('driver', { type: 'chrome' }); // not a W3C driver type\n// after\nkarate.configure('driver', { type: 'chromedriver' });","handlingStrategy":"validation","validationCode":"Set<String> allowed = Set.of(\"chromedriver\", \"geckodriver\");\nif (!allowed.contains(type)) throw new IllegalArgumentException(\"Unknown W3C driver type: \" + type);","typeGuard":null,"tryCatchPattern":"try {\n    options = new W3cDriverOptions(map);\n} catch (IllegalArgumentException e) {\n    // log supported types and fix config\n}","preventionTips":["Centralize driver config in karate-config.js and review type values against docs","Keep case/spacing exact in the type string","Pin a known-good config per environment"],"tags":["configuration","webdriver","invalid-enum","driver-options"],"backgroundTag":"invalid-enum-value","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"}