{"record":{"id":"be2ee16163a369d1","repo":"alibaba/spring-ai-alibaba","slug":"unknown-status-value-valid-values-are-pendin","errorCode":null,"errorMessage":"Unknown status: ${value}. Valid values are: pending, in_progress, completed","messagePattern":"Unknown status: (.+?)\\. Valid values are: pending, in_progress, completed","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"warning","filePath":"spring-ai-alibaba-agent-framework/src/main/java/com/alibaba/cloud/ai/graph/agent/interceptor/todolist/TodoListInterceptor.java","lineNumber":156,"sourceCode":"\t\tpublic static TodoStatus fromValue(String value) {\n\t\t\tif (value == null) {\n\t\t\t\tthrow new IllegalArgumentException(\"Status value cannot be null\");\n\t\t\t}\n\n\t\t\t// First try to match against the lowercase values\n\t\t\tfor (TodoStatus status : values()) {\n\t\t\t\tif (status.value.equals(value)) {\n\t\t\t\t\treturn status;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Fallback: try to match against enum constant names (case-insensitive)\n\t\t\ttry {\n\t\t\t\treturn TodoStatus.valueOf(value.toUpperCase());\n\t\t\t}\n\t\t\tcatch (IllegalArgumentException e) {\n\t\t\t\t// If that fails too, throw a helpful error\n\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\t\"Unknown status: \" + value + \". Valid values are: pending, in_progress, completed\");\n\t\t\t}\n\t\t}\n\n\t\t@JsonValue\n\t\tpublic String getValue() {\n\t\t\treturn value;\n\t\t}\n\t}\n\n\t/**\n\t * Represents a single todo item.\n\t * <p>\n\t * Task descriptions must have two forms:\n\t * <ul>\n\t * <li><b>content</b>: The imperative form describing what needs to be done (e.g., \"Run tests\", \"Build the project\")</li>\n\t * <li><b>activeForm</b>: The present continuous form shown during execution (e.g., \"Running tests\", \"Building the project\").\n\t * When null or blank, content is used as fallback for backward compatibility.</li>","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-agent-framework/src/main/java/com/alibaba/cloud/ai/graph/agent/interceptor/todolist/TodoListInterceptor.java#L138-L174","documentation":"TodoStatus.fromValue() matches lowercase values (pending, in_progress, completed), then falls back to case-insensitive enum-name matching; if both fail it throws an IllegalArgumentException listing the valid values. This keeps the todo list schema strict so downstream state rendering is reliable.","triggerScenarios":"Deserializing a status string such as \"done\", \"finished\", \"in-progress\" (hyphen instead of underscore), or any misspelled value that matches neither the value list nor the enum constant names.","commonSituations":"LLM emitting human-friendly statuses like \"done\" or \"in-progress\"; locale/uppercase mismatch handled by fallback but arbitrary words are not; older clients sending retired status names.","solutions":["Send only pending, in_progress, or completed (case-insensitive enum names also accepted)","Map/sanitize LLM output to a valid status before parsing","Catch IllegalArgumentException and coerce to a default status"],"exampleFix":"// before\n\"status\": \"done\"\n// after\n\"status\": \"completed\"","handlingStrategy":"validation","validationCode":"Set<String> VALID = Set.of(\"pending\", \"in_progress\", \"completed\");\nif (!VALID.contains(value.toLowerCase())) { value = mapAlias(value); }\nTodoStatus status = TodoStatus.fromValue(value);","typeGuard":"boolean isValidStatus(String s) { return s != null && (s.equals(\"pending\") || s.equals(\"in_progress\") || s.equals(\"completed\") || s.equalsIgnoreCase(\"PENDING\") || s.equalsIgnoreCase(\"IN_PROGRESS\") || s.equalsIgnoreCase(\"COMPLETED\")); }","tryCatchPattern":"try { status = TodoStatus.fromValue(value); } catch (IllegalArgumentException e) { log.warn(\"Unknown status '{}', defaulting to PENDING\", value); status = TodoStatus.PENDING; }","preventionTips":["List the exact allowed values in LLM prompts/tool schemas","Normalize hyphens to underscores before parsing","Map known aliases (done -> completed) before deserialization"],"tags":["jackson","enum","deserialization","todolist"],"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"}