alibaba/spring-ai-alibaba · error · RuntimeException

ChatClient successfully returned, but the returned data is…

Error message

ChatClient successfully returned, but the returned data is invalid.

What it means

After ParameterParsingNode successfully parses the LLM JSON into a Response record, if isSuccess() is true but the data field is null it throws RuntimeException('ChatClient successfully returned, but the returned data is invalid.'). The model claimed success (success=true) but provided no extracted data payload, which the node treats as an inconsistent/invalid response.

Solutions

  1. Inspect the raw LLM output to confirm data was truly absent
  2. Improve the instruction with explicit examples showing a populated data field on success
  3. Validate inputText contains extractable content for the declared parameters
  4. Retry the call or treat success-without-data as failure in downstream handling
Defensive patterns

Strategy: try-catch

Try / catch

try { out = node.apply(state); } catch (RuntimeException e) { if (e.getMessage().contains("returned data is invalid")) { log.warn("LLM reported success without data"); retryOrFallback(); } }

Prevention

When it happens

Trigger: The LLM returns {"success": true} (or omits data) without a populated data field, so responseJson.isSuccess() is true while responseJson.data() is null.

Common situations: Prompt schema example mismatch so the model fills success but leaves data empty; parameters list empty or unextractable from the input text; model returning null data for edge-case inputs.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09). Data as JSON: /api/errors/497a511f775a1e8e. 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:208

				.getOutput()
				.getText();
			// Remove Markdown markers
			if (rawJson != null) {
				rawJson = rawJson.replace("```json", "").replace("```", "").trim();
			}

			Map<String, Object> result = new HashMap<>();
			Response responseJson;
			try {
				responseJson = OBJECT_MAPPER.readValue(rawJson, Response.class);
			}
			catch (JsonProcessingException e) {
				throw new RuntimeException("ChatClient successfully returned, but the returned json is invalid.");
			}

			if (responseJson.isSuccess()) {
				if (responseJson.data() == null) {
					throw new RuntimeException("ChatClient successfully returned, but the returned data is invalid.");
				}
				result.put(successKey, true);
				result.put(dataKey, responseJson.data());
				result.put(reasonKey, "success");
			}
			else {
				result.put(successKey, false);
				result.put(reasonKey, Optional.ofNullable(responseJson.reason()).orElse("reason is empty"));
			}

			return result;
		}
		catch (Exception e) {
			return Map.of(successKey, false, reasonKey, e.getMessage());
		}
	}

	public record Param(String name, String type, String description) {

View on GitHub (pinned to f82da0b50f)