flowable/flowable-engine · error · UncheckedIOException

Failed to read text value

Error message

Failed to read text value

What it means

Jackson2VariableJsonMapper.readTree(String) parses a text variable value into a Jackson JsonNode and translates any Jackson JsonProcessingException into an UncheckedIOException with message 'Failed to read text value'. It signals that the stored text is not valid JSON.

Solutions

  1. Validate the text is well-formed JSON before calling readTree
  2. Inspect the chained IOException cause for the exact parse position
  3. Migrate/re-write malformed stored variable values; wrap the call in try-catch for UncheckedIOException with a fallback

Example fix

// before
Object node = mapper.readTree(userInput);
// after
if (userInput != null && userInput.trim().startsWith("{")) {
    Object node = mapper.readTree(userInput);
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (text == null || text.isBlank()) throw new IllegalArgumentException("Empty JSON text");
try (var p = new com.fasterxml.jackson.core.JsonFactory().createParser(text)) { while (p.nextToken() != null) {} }

Try / catch

try { return mapper.readTree(textValue); } catch (UncheckedIOException e) { logger.error("Invalid JSON variable value: {}", abbreviate(textValue), e); throw e; }

Prevention

When it happens

Trigger: Calling readTree(String) on text that is empty, truncated, or not valid JSON (e.g. a plain string like 'hello' or '{oops').

Common situations: Variable values persisted as raw strings by older Flowable versions or external writers; corrupted/truncated JSON in a variable table; passing user input directly as JSON.

Understand the failure class

Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/e0317ca8f379b6c3. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/json/jackson2/Jackson2VariableJsonMapper.java:43

/**
 * @author Filip Hrisafov
 */
@Deprecated
public class Jackson2VariableJsonMapper implements VariableJsonMapper {

    protected final ObjectMapper objectMapper;

    public Jackson2VariableJsonMapper(ObjectMapper objectMapper) {
        this.objectMapper = objectMapper;
    }

    @Override
    public Object readTree(String textValue) {
        try {
            return objectMapper.readTree(textValue);
        } catch (JsonProcessingException e) {
            throw new UncheckedIOException("Failed to read text value", e);
        }
    }

    @Override
    public Object readTree(byte[] bytes) {
        try {
            return objectMapper.readTree(bytes);
        } catch (IOException e) {
            throw new UncheckedIOException("Failed to read text value", e);
        }
    }

    @Override
    public Object deepCopy(Object value) {
        return ((JsonNode) value).deepCopy();
    }

    @Override

View on GitHub (pinned to d6d39ce1c6)