karatelabs/karate · error · RuntimeException
configure requires '=' assignment:
Error message
configure requires '=' assignment:
What it means
The `configure` keyword requires the form `configure key = expression`; the step text must contain an '=' assignment operator for StepUtils.findAssignmentOperator to split the key from the value expression. When no '=' is present the executor cannot determine what to configure and throws with the full step text.
Solutions
- Add the '=' assignment: `configure headers = { Authorization: 'Bearer x' }`
- If the value is large, keep '=' with an empty expression and supply a docstring
- Replace with JS form: `karate.configure('key', value)` inside an eval step
- Check for typos that swallowed the '=' character
Example fix
// before * configure ssl true // after * configure ssl = true
Defensive patterns
Strategy: validation
Validate before calling
// step text check in custom runner
if (!stepText.contains("=")) throw new IllegalArgumentException("configure requires '=' assignment"); Prevention
- Always write configure as key = value
- Use docstrings only after '=' with an empty expression
- Search test suites for 'configure ' steps lacking '='
When it happens
Trigger: Writing `configure headers` without `= value`; using `:` or other separators instead of `=`; configure with only a docstring but no `=` in the text (the docstring fallback only applies AFTER the '=' split succeeds).
Common situations: Typos like `configure retry count 5`; pasting config from JSON-style syntax; translating `karate.configure('x', y)` JS calls into keyword form incorrectly.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- assignment to constant
- assignment to constant
- cannot set . (on )
- cannot set on
- cannot write to optional call expression
AI-assisted analysis of karatelabs/karate@a22eb90246 (2026-09-12).
Data as JSON: /api/errors/214045845bccc3d1.
Report an issue: GitHub.
Appendix: source
Thrown at karate-core/src/main/java/io/karatelabs/core/StepExecutor.java:3007
html = runtime.getKarate().doc(Map.of("read", path));
} else if (value instanceof Map) {
html = runtime.getKarate().doc((Map<String, Object>) value);
} else {
throw new RuntimeException("doc requires a string path or map with 'read' key, got: " + value);
}
// Embed the rendered HTML in the step result for reports
if (html != null && !html.isEmpty()) {
LogContext.get().embed(html.getBytes(java.nio.charset.StandardCharsets.UTF_8), "text/html");
}
}
// ========== Config ==========
private void executeConfigure(Step step) {
String text = step.getText();
int eqIndex = StepUtils.findAssignmentOperator(text);
if (eqIndex < 0) {
throw new RuntimeException("configure requires '=' assignment: " + text);
}
String key = text.substring(0, eqIndex).trim();
String expr = text.substring(eqIndex + 1).trim();
if (expr.isEmpty() && step.getDocString() != null) {
expr = step.getDocString();
}
Object value;
if (key.equals("javaBridgeEnabled")) {
// Toggle Java interop (Java.type) for this engine. Mocks disable it by default
// so untrusted request data evaluated as embedded expressions cannot reach Java
// class loading; a trusted feature opts back in with `configure javaBridgeEnabled = true`.
Object enabled = evalKarateExpression(expr);
runtime.getKarate().setJavaBridgeEnabled(Boolean.parseBoolean(String.valueOf(enabled)));
return;
}
if (key.equals("requestExpressionsEnabled")) {
// Opt a mock back in to evaluating embedded expressions in request-derived data
// (off by default). Re-opens the injection surface - only for trusted mocks.View on GitHub (pinned to a22eb90246)