{"record":{"id":"895fbbd6fb9f129f","repo":"alibaba/spring-ai-alibaba","slug":"invalid-write-mode-item-writemode","errorCode":null,"errorMessage":"Invalid write mode: {item.writeMode()}","messagePattern":"Invalid write mode: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spring-boot-starters/spring-ai-alibaba-starter-builtin-nodes/src/main/java/com/alibaba/cloud/ai/graph/node/AssignerNode.java","lineNumber":124,"sourceCode":"\t\t\t\tcase CLEAR -> {\n\t\t\t\t\tif (targetValue instanceof List) {\n\t\t\t\t\t\tyield new ArrayList<>();\n\t\t\t\t\t}\n\t\t\t\t\telse if (targetValue instanceof Map) {\n\t\t\t\t\t\tyield new HashMap<>();\n\t\t\t\t\t}\n\t\t\t\t\telse if (targetValue instanceof String) {\n\t\t\t\t\t\tyield \"\";\n\t\t\t\t\t}\n\t\t\t\t\telse if (targetValue instanceof Number) {\n\t\t\t\t\t\tyield 0;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tyield null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase INPUT_CONSTANT -> item.inputValue();\n\t\t\t\tdefault -> throw new IllegalArgumentException(\"Invalid write mode: \" + item.writeMode());\n\t\t\t};\n\t\t\tupdates.put(item.targetKey, result);\n\t\t}\n\t\treturn updates;\n\t}\n\n\t// Builder pattern\n\tpublic static Builder builder() {\n\t\treturn new Builder();\n\t}\n\n\tpublic static class Builder {\n\n\t\tprivate List<AssignItem> items = new ArrayList<>();\n\n\t\tpublic Builder setItems(List<AssignItem> items) {\n\t\t\tthis.items = new ArrayList<>(items);\n\t\t\treturn this;","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-boot-starters/spring-ai-alibaba-starter-builtin-nodes/src/main/java/com/alibaba/cloud/ai/graph/node/AssignerNode.java#L106-L142","documentation":"AssignerNode.apply throws this IllegalArgumentException when a write item's writeMode enum value hits the default branch of the switch, i.e. a write mode the node does not implement (typically a newly added or unknown enum constant). It indicates the assigner does not support that mode.","triggerScenarios":"Constructing an AssignerNode item with a WriteMode constant not covered by apply's switch (e.g. a mode added in a newer/older library version or INPUT_CONSTANT-adjacent custom modes), so the default case throws.","commonSituations":"Version mismatch between the workflow definition (serialized write modes) and the library runtime; typos or custom enum extensions; upgrading spring-ai-alibaba-starter-builtin-nodes adds modes your rules use but the pinned runtime lacks.","solutions":["Use only write modes supported by your library version (check the WriteMode enum and apply's switch)","Align library versions so the runtime knows all write modes in your workflow definitions","Add the missing case to the switch if you maintain a fork/custom mode"],"exampleFix":"// before\nItem.builder().targetKey(\"k\").writeMode(SomeCustomMode.MERGE) // unsupported\n// after\nItem.builder().targetKey(\"k\").writeMode(WriteMode.OVERWRITE)","handlingStrategy":"validation","validationCode":"Set<WriteMode> supported = Set.of(WriteMode.OVERWRITE, WriteMode.APPEND, WriteMode.CLEAR, WriteMode.INPUT_CONSTANT);\nif (!supported.contains(item.writeMode())) throw new ConfigException(\"unsupported write mode: \" + item.writeMode());","typeGuard":null,"tryCatchPattern":"try {\n    state = assignerNode.apply(state);\n} catch (IllegalArgumentException e) {\n    throw new WorkflowConfigException(\"Check WriteMode against library version: \" + e.getMessage(), e);\n}","preventionTips":["Pin the starter-builtin-nodes version and only use WriteMode constants from that version","Check the WriteMode enum after upgrades for new/renamed modes","Validate serialized workflow definitions against the runtime's supported modes"],"tags":["assigner","enum","unsupported-value","version-mismatch"],"backgroundTag":"unsupported-enum-value","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}