{"record":{"id":"e0317ca8f379b6c3","repo":"flowable/flowable-engine","slug":"failed-to-read-text-value","errorCode":null,"errorMessage":"Failed to read text value","messagePattern":"Failed to read text value","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/json/jackson2/Jackson2VariableJsonMapper.java","lineNumber":43,"sourceCode":"\n/**\n * @author Filip Hrisafov\n */\n@Deprecated\npublic class Jackson2VariableJsonMapper implements VariableJsonMapper {\n\n    protected final ObjectMapper objectMapper;\n\n    public Jackson2VariableJsonMapper(ObjectMapper objectMapper) {\n        this.objectMapper = objectMapper;\n    }\n\n    @Override\n    public Object readTree(String textValue) {\n        try {\n            return objectMapper.readTree(textValue);\n        } catch (JsonProcessingException e) {\n            throw new UncheckedIOException(\"Failed to read text value\", e);\n        }\n    }\n\n    @Override\n    public Object readTree(byte[] bytes) {\n        try {\n            return objectMapper.readTree(bytes);\n        } catch (IOException e) {\n            throw new UncheckedIOException(\"Failed to read text value\", e);\n        }\n    }\n\n    @Override\n    public Object deepCopy(Object value) {\n        return ((JsonNode) value).deepCopy();\n    }\n\n    @Override","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/json/jackson2/Jackson2VariableJsonMapper.java#L25-L61","documentation":"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.","triggerScenarios":"Calling readTree(String) on text that is empty, truncated, or not valid JSON (e.g. a plain string like 'hello' or '{oops').","commonSituations":"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.","solutions":["Validate the text is well-formed JSON before calling readTree","Inspect the chained IOException cause for the exact parse position","Migrate/re-write malformed stored variable values; wrap the call in try-catch for UncheckedIOException with a fallback"],"exampleFix":"// before\nObject node = mapper.readTree(userInput);\n// after\nif (userInput != null && userInput.trim().startsWith(\"{\")) {\n    Object node = mapper.readTree(userInput);\n}","handlingStrategy":"try-catch","validationCode":"if (text == null || text.isBlank()) throw new IllegalArgumentException(\"Empty JSON text\");\ntry (var p = new com.fasterxml.jackson.core.JsonFactory().createParser(text)) { while (p.nextToken() != null) {} }","typeGuard":null,"tryCatchPattern":"try { return mapper.readTree(textValue); } catch (UncheckedIOException e) { logger.error(\"Invalid JSON variable value: {}\", abbreviate(textValue), e); throw e; }","preventionTips":["Validate JSON before persisting variables","Catch UncheckedIOException at variable-read boundaries","Migrate legacy string variables to valid JSON"],"tags":["jackson","json","parsing","variables"],"backgroundTag":"json-parse-error","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}