{"record":{"id":"c4979d16051c7776","repo":"kestra-io/kestra","slug":"invalid-ion-e-getmessage","errorCode":null,"errorMessage":"Invalid ion: {e.getMessage()}","messagePattern":"Invalid ion: (.+?)","errorType":"exception","errorClass":"PebbleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/runners/pebble/functions/FromIonFunction.java","lineNumber":70,"sourceCode":"\n        boolean allRows = args.containsKey(\"allRows\") ? (Boolean) args.get(\"allRows\") : false;\n\n        try {\n            Flux<Object> flux = FileSerde.readAll(new ByteArrayInputStream(ionBytes));\n\n            if (!allRows) {\n                flux = flux.take(1);\n            }\n\n            Stream<Object> data = flux.toStream();\n\n            if (allRows) {\n                return data.toList();\n            }\n\n            return data.findFirst().orElse(null);\n        } catch (RuntimeException | IOException e) {\n            throw new PebbleException(null, \"Invalid ion: \" + e.getMessage(), lineNumber, self.getName());\n        }\n    }\n}\n","sourceCodeStart":52,"sourceCodeEnd":74,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/functions/FromIonFunction.java#L52-L74","documentation":"Thrown by 'fromIon' when FileSerde.readAll or the subsequent stream/terminal operation raises a RuntimeException or IOException. This means the content was a string/bytes but could not be parsed as valid Ion (or Kestra's row Ion format), so the deserialization failed mid-read.","triggerScenarios":"Passing fromIon() a string that is not valid Ion (e.g. plain CSV, JSON, or free text); truncated or corrupted Ion bytes; a file whose content is a different serialization format mislabeled as .ion.","commonSituations":"Reading a JSON or CSV file with fromIon() by mistake; partial file reads producing incomplete bytes; mixing up fromIon() and fromJson() for the file format at hand.","solutions":["Confirm the content is actually Kestra Ion; if it is JSON, use fromJson() instead.","If reading from a file, ensure the producing task wrote it in Ion format (e.g. set row encoding to ION).","Inspect the source bytes to verify they are well-formed Ion before passing them to fromIon()."],"exampleFix":"# before - JSON content passed to fromIon()\nrows: \"{{ fromIon(readFile('data.json')) }}\"\n# after - match parser to format\nrows: \"{{ fromJson(readFile('data.json')) }}\"","handlingStrategy":"validation","validationCode":"# Confirm the content is Ion before parsing; if it is JSON, use fromJson() instead.\n# {{ (content starts with '{' or content starts with '[') ? fromJson(content) : fromIon(content) }}","typeGuard":null,"tryCatchPattern":"# Pebble has no try/catch. In a wrapper task, catch RuntimeException|IOException and return null or a fallback.","preventionTips":["Confirm the source file/content is Kestra Ion before calling fromIon().","Match the parser to the format (fromJson for JSON, fromIon for Ion).","Ensure producing tasks write Ion when you intend to read with fromIon().","Inspect the bytes to verify well-formed Ion."],"tags":["pebble","fromion","serialization","ion","parse-error","validation"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}