{"record":{"id":"388cf56843742aa2","repo":"karatelabs/karate","slug":"multipart-field-requires-assignment","errorCode":null,"errorMessage":"multipart field requires '=' assignment: ","messagePattern":"multipart field requires '=' assignment: ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"karate-core/src/main/java/io/karatelabs/core/StepExecutor.java","lineNumber":2483,"sourceCode":"            // Direct string value - could be file path or content\n            multipartMap.put(\"value\", value);\n        } else if (value instanceof byte[]) {\n            multipartMap.put(\"value\", value);\n        } else {\n            multipartMap.put(\"value\", value);\n        }\n\n        http().multiPart(multipartMap);\n    }\n\n    /**\n     * Handles: multipart field name = 'value'\n     */\n    private void executeMultipartField(Step step) {\n        String text = step.getText();\n        int eqIndex = StepUtils.findAssignmentOperator(text);\n        if (eqIndex < 0) {\n            throw new RuntimeException(\"multipart field requires '=' assignment: \" + text);\n        }\n        String name = text.substring(0, eqIndex).trim();\n        String expr = text.substring(eqIndex + 1).trim();\n\n        Object value = runtime.eval(wrapJsonLikeExpression(expr));\n\n        Map<String, Object> multipartMap = new HashMap<>();\n        multipartMap.put(\"name\", name);\n        multipartMap.put(\"value\", value);\n\n        http().multiPart(multipartMap);\n    }\n\n    /**\n     * Handles: multipart fields { name: 'value', other: 'data' }\n     * V1 behavior: if field value is a map with 'value' key, merge it (not nest it)\n     */\n    @SuppressWarnings(\"unchecked\")","sourceCodeStart":2465,"sourceCodeEnd":2501,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/core/StepExecutor.java#L2465-L2501","documentation":"The `multipart field <name> = <value>` step requires an `=` assignment between the field name and its value expression. StepExecutor's assignment-operator search failed, so it throws a RuntimeException containing the raw step text.","triggerScenarios":"Writing `multipart field foo` without a value, or malformed text where `StepUtils.findAssignmentOperator` cannot locate `=` (e.g. `multipart field foo 'bar'` using a space instead of `=`).","commonSituations":"Hand-writing multipart forms from memory; migrating from syntaxes that used different separators; copy-paste errors dropping `= 'value'`.","solutions":["Write `multipart field foo = 'value'` exactly, with `=` between name and value.","Check that the field name itself doesn't confuse the parser (avoid stray characters).","For many fields, use `multipart fields { foo: 'bar', baz: 'qux' }` instead of individual lines.","Consult the docs for the exact multipart field grammar."],"exampleFix":"// before\nAnd multipart field description 'hello'\n// after\nAnd multipart field description = 'hello'","handlingStrategy":"validation","validationCode":"// Confirm the step has name = value form\n* assert 'multipart field desc'.indexOf('=') >= 0 || 'add = value'","typeGuard":null,"tryCatchPattern":"try { scenario.run(step) } catch (RuntimeException e) { if (e.getMessage().startsWith(\"multipart field requires '='\")) { /* correct the step syntax */ } throw e; }","preventionTips":["Write `multipart field <name> = <value>` exactly.","Use `multipart fields { ... }` for multiple fields at once.","Enable feature-file linting in CI.","Copy step syntax from the official docs rather than memory."],"tags":["karate","multipart","syntax","http"],"backgroundTag":"invalid-argument-format","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"}