alibaba/spring-ai-alibaba · error · IllegalArgumentException
inputText is empty.
Error message
inputText is empty.
What it means
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.
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
Example fix
// before
state = new OverAllState(); // never sets 'input'
// after
state.with("input", userText); // ensure non-empty before ParameterParsingNode runs Defensive patterns
Strategy: validation
Validate before calling
String text = (String) state.value(inputTextKey).orElse("");
if (!StringUtils.hasText(text)) { throw new IllegalStateException("state['" + inputTextKey + "'] must be non-empty before ParameterParsingNode"); } Type guard
boolean hasInput(OverAllState s, String key) { return s.value(key).filter(v -> v instanceof String && StringUtils.hasText((String) v)).isPresent(); } Try / catch
try { out = node.apply(state); } catch (IllegalArgumentException e) { log.error("inputText missing/empty", e); } Prevention
- 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
When it happens
Trigger: Executing the node when state.value(inputTextKey) is absent or contains an empty/blank string, and the constructor's inputText was also null/blank.
Common situations: 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.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- AgentCard or AgentCardProvider must be provided
- AgentScope Model must be provided for AgentScope routing…
- AgentScope routing flow requires at least one sub-agent
- appName cannot be null or empty
- At least one fallback model must be specified
AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09).
Data as JSON: /api/errors/e31fc47dce0deb9e.
Report an issue: GitHub.
Appendix: source
Thrown at spring-boot-starters/spring-ai-alibaba-starter-builtin-nodes/src/main/java/com/alibaba/cloud/ai/graph/node/ParameterParsingNode.java:162
Map<String, Object> params = Stream.of(template)
.map(VAR_TEMPLATE_PATTERN::matcher)
.map(Matcher::results)
.map(results -> results.collect(Collectors.toUnmodifiableMap(r -> r.group(1),
r -> state.value(r.group(1)).orElse(""), (a, b) -> b)))
.findFirst()
.orElseThrow();
return new PromptTemplate(template).render(params);
}
@Override
public Map<String, Object> apply(OverAllState state) throws Exception {
try {
String currentInputText = this.inputText;
if (StringUtils.hasText(inputTextKey)) {
currentInputText = (String) state.value(inputTextKey).orElse(currentInputText);
}
if (!StringUtils.hasText(currentInputText)) {
throw new IllegalArgumentException("inputText is empty.");
}
Map<String, Object> promptInput = new HashMap<>();
promptInput.put("inputText",
String.format("[Instruction: %s] %s", renderTemplate(state, instruction), currentInputText));
promptInput.put("parameters", OBJECT_MAPPER.writeValueAsString(parameters));
List<Message> messages = new ArrayList<>();
UserMessage userMessage1 = new UserMessage(PARAMETER_PARSING_USER_PROMPT_1);
AssistantMessage assistantMessage1 = new AssistantMessage(PARAMETER_PARSING_ASSISTANT_PROMPT_1);
UserMessage userMessage2 = new UserMessage(PARAMETER_PARSING_USER_PROMPT_2);
AssistantMessage assistantMessage2 = new AssistantMessage(PARAMETER_PARSING_ASSISTANT_PROMPT_2);
messages.add(userMessage1);
messages.add(assistantMessage1);
messages.add(userMessage2);
messages.add(assistantMessage2);
ChatResponse response = chatClient.prompt()View on GitHub (pinned to f82da0b50f)