{"record":{"id":"8fe37aa22bbed6cf","repo":"karatelabs/karate","slug":"unknown-keyword-keyword","errorCode":null,"errorMessage":"unknown keyword: <keyword>","messagePattern":"unknown keyword: <keyword>","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"karate-core/src/main/java/io/karatelabs/core/StepExecutor.java","lineNumber":270,"sourceCode":"                    case \"call\" -> executeCall(step);\n                    case \"callonce\" -> executeCallOnce(step);\n                    case \"eval\" -> executeEval(step);\n                    case \"doc\" -> executeDoc(step);\n\n                    // Config\n                    case \"configure\" -> executeConfigure(step);\n\n                    // Browser driver\n                    case \"driver\" -> executeDriver(step);\n\n                    default -> {\n                        // Check if text starts with ( - means keyword is a function name like myFunc('a')\n                        // We only do this check here (not earlier) because valid keywords like \"eval\"\n                        // could have text starting with ( like \"eval (1 + 2)\"\n                        if (text != null && text.trim().startsWith(\"(\")) {\n                            runtime.eval(keyword + text, step);\n                        } else {\n                            throw new RuntimeException(\"unknown keyword: \" + keyword);\n                        }\n                    }\n                }\n            }\n\n            long elapsedNanos = System.nanoTime() - startNanos;\n            StepResult result = StepResult.passed(step, startTime, elapsedNanos);\n            collectLogsAndEmbeds(result);\n\n            // Notify interceptor of successful step execution\n            if (finalInterceptor != null && finalPointFactory != null) {\n                Object afterPoint = finalPoint;\n                if (afterPoint == null) {\n                    String sourcePath = step.getFeature().getResource().getRelativePath();\n                    afterPoint = finalPointFactory.create(io.karatelabs.js.DebugPointFactory.GHERKIN_STEP, step.getLine(), sourcePath, step, null);\n                }\n                finalInterceptor.afterExecute(afterPoint, result, null);\n            }","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/core/StepExecutor.java#L252-L288","documentation":"Karate could not match the first word of a step line to any known Gherkin keyword (Given/When/Then/And/But, def, call, eval, method, etc.). If the remaining text starts with '(' the keyword is treated as a function-call name and evaluated (e.g. myFunc('a')); otherwise this RuntimeException is thrown because the line is not a valid step.","triggerScenarios":"A .feature step whose first token is not a recognized Karate/Gherkin keyword and whose text does not begin with '(' — e.g. a misspelled keyword ('Def', 'whenn'), a stray word, or a step placed in a feature run through the step executor directly.","commonSituations":"Typos in step keywords; copying steps from another DSL; language/locale mismatches producing non-English keywords; accidentally writing plain text lines inside a Scenario; calling StepExecutor.execute programmatically with a hand-built Step.","solutions":["Fix the first word of the step to a valid keyword (Given, When, Then, And, But, def, call, eval, print, method, match, assert, etc.)","If you intended a function call, prefix the expression so the line is a valid 'def' or use 'eval myFunc(...)'","Check the feature file for mixed-language keywords if running non-English features","If building Step objects in code, verify the keyword string matches Karate's keyword set exactly (case-sensitive)"],"exampleFix":"// before (feature)\nDef x = 5\nwhenn url == '/foo'\n// after\ndef x = 5\nWhen url == '/foo'","handlingStrategy":"validation","validationCode":"// check the step keyword before executing\njava.util.Set<String> known = java.util.Set.of(\"Given\",\"When\",\"Then\",\"And\",\"But\",\"def\",\"call\",\"eval\",\"print\",\"method\",\"match\",\"assert\",\"url\",\"path\",\"request\",\"response\",\"status\",\"header\",\"headers\",\"param\",\"cookie\",\"configure\",\"karate\");\nboolean keywordValid = known.contains(stepText.split(\"\\\\s+\", 2)[0]);","typeGuard":null,"tryCatchPattern":"try { executor.execute(step); } catch (RuntimeException e) { if (e.getMessage().startsWith(\"unknown keyword: \")) { throw new IllegalStateException(\"fix feature line: \" + e.getMessage()); } throw e; }","preventionTips":["Lint feature files for keyword typos","Keep features in English or configure the expected language","Review generated/hand-built Step objects for exact keyword strings"],"tags":["karate","feature-file","syntax","keyword"],"backgroundTag":"invalid-argument-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"}