{"record":{"id":"2e84d3a8a8fabb3e","repo":"alibaba/spring-ai-alibaba","slug":"unknown-jumpto-value-valid-values-are-tool-mo","errorCode":null,"errorMessage":"Unknown JumpTo value: . Valid values are: tool, model, end","messagePattern":"Unknown JumpTo value: \\. Valid values are: tool, model, end","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-agent-framework/src/main/java/com/alibaba/cloud/ai/graph/agent/hook/JumpTo.java","lineNumber":65,"sourceCode":"\t * @param value the string value to convert\n\t * @return the corresponding JumpTo enum instance\n\t * @throws IllegalArgumentException if the value does not match any enum constant\n\t */\n\t@JsonCreator\n\tpublic static JumpTo fromString(String value) {\n\t\tif (value == null) {\n\t\t\tthrow new IllegalArgumentException(\"JumpTo value cannot be null\");\n\t\t}\n\n\t\t// Try case-insensitive matching first\n\t\tfor (JumpTo jumpTo : values()) {\n\t\t\tif (jumpTo.name().equalsIgnoreCase(value)) {\n\t\t\t\treturn jumpTo;\n\t\t\t}\n\t\t}\n\n\t\t// If no match found, throw exception with helpful message\n\t\tthrow new IllegalArgumentException(\n\t\t\t\"Unknown JumpTo value: \" + value + \". Valid values are: tool, model, end\");\n\t}\n\n\t/**\n\t * Converts a string to a JumpTo enum instance, returning null if the value is null or invalid.\n\t * This is a safe version that doesn't throw exceptions.\n\t * \n\t * @param value the string value to convert\n\t * @return the corresponding JumpTo enum instance, or null if value is null or invalid\n\t */\n\tpublic static JumpTo fromStringOrNull(String value) {\n\t\tif (value == null || value.trim().isEmpty()) {\n\t\t\treturn null;\n\t\t}\n\n\t\ttry {\n\t\t\treturn fromString(value);\n\t\t}","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-agent-framework/src/main/java/com/alibaba/cloud/ai/graph/agent/hook/JumpTo.java#L47-L83","documentation":"JumpTo.fromString throws IllegalArgumentException when the string matches none of the enum constants. Valid values are tool, model, end (case-insensitive); the message includes the offending value and valid options.","triggerScenarios":"Calling JumpTo.fromString with a misspelled or unsupported value (e.g. \"ToolCall\", \"finish\", \"exit\"), or deserializing untrusted JSON into a JumpTo field via the @JsonCreator.","commonSituations":"Typos in hook configuration; LLM-generated or user-supplied JSON with an invalid jump target; version change where an old constant was removed.","solutions":["Use one of the valid values: tool, model, end (case-insensitive)","Use fromStringOrNull or wrap in try-catch to handle unknown values gracefully","Normalize/validate the string against JumpTo values() before converting"],"exampleFix":"// before\nJumpTo jump = JumpTo.fromString(\"finish\");\n// after\nJumpTo jump = JumpTo.fromStringOrNull(input); // null handled explicitly","handlingStrategy":"try-catch","validationCode":"boolean valid = value != null && java.util.Arrays.stream(JumpTo.values()).anyMatch(j -> j.name().equalsIgnoreCase(value));","typeGuard":"static JumpTo safeJump(String v) { return JumpTo.fromStringOrNull(v); }","tryCatchPattern":"JumpTo jump;\ntry {\n    jump = JumpTo.fromString(value);\n} catch (IllegalArgumentException e) {\n    log.warn(\"Invalid jump target: {}\", value);\n    jump = JumpTo.END;\n}","preventionTips":["Only emit tool/model/end as jump targets from hook logic","Validate LLM/user-supplied JSON before deserializing into JumpTo","Use fromStringOrNull and handle null explicitly instead of catching"],"tags":["java","agent-framework","hooks","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}