{"record":{"id":"e31fc47dce0deb9e","repo":"alibaba/spring-ai-alibaba","slug":"inputtext-is-empty","errorCode":null,"errorMessage":"inputText is empty.","messagePattern":"inputText is empty\\.","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/ParameterParsingNode.java","lineNumber":162,"sourceCode":"\t\tMap<String, Object> params = Stream.of(template)\n\t\t\t.map(VAR_TEMPLATE_PATTERN::matcher)\n\t\t\t.map(Matcher::results)\n\t\t\t.map(results -> results.collect(Collectors.toUnmodifiableMap(r -> r.group(1),\n\t\t\t\t\tr -> state.value(r.group(1)).orElse(\"\"), (a, b) -> b)))\n\t\t\t.findFirst()\n\t\t\t.orElseThrow();\n\t\treturn new PromptTemplate(template).render(params);\n\t}\n\n\t@Override\n\tpublic Map<String, Object> apply(OverAllState state) throws Exception {\n\t\ttry {\n\t\t\tString currentInputText = this.inputText;\n\t\t\tif (StringUtils.hasText(inputTextKey)) {\n\t\t\t\tcurrentInputText = (String) state.value(inputTextKey).orElse(currentInputText);\n\t\t\t}\n\t\t\tif (!StringUtils.hasText(currentInputText)) {\n\t\t\t\tthrow new IllegalArgumentException(\"inputText is empty.\");\n\t\t\t}\n\n\t\t\tMap<String, Object> promptInput = new HashMap<>();\n\t\t\tpromptInput.put(\"inputText\",\n\t\t\t\t\tString.format(\"[Instruction: %s] %s\", renderTemplate(state, instruction), currentInputText));\n\t\t\tpromptInput.put(\"parameters\", OBJECT_MAPPER.writeValueAsString(parameters));\n\n\t\t\tList<Message> messages = new ArrayList<>();\n\t\t\tUserMessage userMessage1 = new UserMessage(PARAMETER_PARSING_USER_PROMPT_1);\n\t\t\tAssistantMessage assistantMessage1 = new AssistantMessage(PARAMETER_PARSING_ASSISTANT_PROMPT_1);\n\t\t\tUserMessage userMessage2 = new UserMessage(PARAMETER_PARSING_USER_PROMPT_2);\n\t\t\tAssistantMessage assistantMessage2 = new AssistantMessage(PARAMETER_PARSING_ASSISTANT_PROMPT_2);\n\t\t\tmessages.add(userMessage1);\n\t\t\tmessages.add(assistantMessage1);\n\t\t\tmessages.add(userMessage2);\n\t\t\tmessages.add(assistantMessage2);\n\n\t\t\tChatResponse response = chatClient.prompt()","sourceCodeStart":144,"sourceCodeEnd":180,"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/ParameterParsingNode.java#L144-L180","documentation":"ParameterParsingNode.apply() resolves the text to parse from the node's fixed inputText or, if inputTextKey is set, from the graph state. If the resolved value is null/blank it throws IllegalArgumentException('inputText is empty.') because there is no text for the LLM parameter-extraction prompt to work on.","triggerScenarios":"Executing the node when state.value(inputTextKey) is absent or contains an empty/blank string, and the constructor's inputText was also null/blank.","commonSituations":"Upstream node never wrote the expected key into state; key name typo between producer and consumer; upstream node emitted an empty string on a failed extraction.","solutions":["Ensure an upstream node writes a non-empty string under inputTextKey before this node runs","Pass a non-blank default inputText to the constructor as a fallback","Log/inspect the OverAllState before the node to confirm the key and value","Fix the key name mismatch if producer and consumer use different keys"],"exampleFix":"// before\nstate = new OverAllState(); // never sets 'input'\n// after\nstate.with(\"input\", userText); // ensure non-empty before ParameterParsingNode runs","handlingStrategy":"validation","validationCode":"String text = (String) state.value(inputTextKey).orElse(\"\");\nif (!StringUtils.hasText(text)) { throw new IllegalStateException(\"state['\" + inputTextKey + \"'] must be non-empty before ParameterParsingNode\"); }","typeGuard":"boolean hasInput(OverAllState s, String key) { return s.value(key).filter(v -> v instanceof String && StringUtils.hasText((String) v)).isPresent(); }","tryCatchPattern":"try { out = node.apply(state); } catch (IllegalArgumentException e) { log.error(\"inputText missing/empty\", e); }","preventionTips":["Guarantee upstream nodes write inputTextKey before this node executes","Provide a non-blank default inputText in the constructor","Use shared constants for state keys between producer and consumer nodes"],"tags":["empty-input","state-graph","validation"],"backgroundTag":"empty-required-field","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}