{"record":{"id":"105d1472df476a8d","repo":"pentaho/pentaho-kettle","slug":"error-parsing-message","errorCode":null,"errorMessage":"Error parsing message","messagePattern":"Error parsing message","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/hl7/core/src/main/java/org/pentaho/di/trans/steps/hl7input/HL7Input.java","lineNumber":98,"sourceCode":"      for ( HL7Value value : values ) {\n        Object[] output = RowDataUtil.createResizedCopy( r, data.outputRowMeta.size() );\n        int outputIndex = getInputRowMeta().size();\n\n        output[outputIndex++] = value.getParentGroup();\n        output[outputIndex++] = value.getGroupName();\n        output[outputIndex++] = value.getVersion();\n        output[outputIndex++] = value.getStructureName();\n        output[outputIndex++] = value.getStructureNumber();\n        output[outputIndex++] = value.getFieldName();\n        output[outputIndex++] = value.getCoordinate();\n        output[outputIndex++] = value.getDataType();\n        output[outputIndex++] = value.getDescription();\n        output[outputIndex++] = value.getValue();\n\n        putRow( data.outputRowMeta, output );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( \"Error parsing message\", e );\n    }\n\n    if ( checkFeedback( getLinesWritten() ) ) {\n      if ( log.isBasic() ) {\n        logBasic( BaseMessages.getString( PKG, \"HL7Input.Log.LineNumber\" ) + getLinesWritten() );\n      }\n    }\n\n    return true;\n  }\n}\n","sourceCodeStart":80,"sourceCodeEnd":110,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/hl7/core/src/main/java/org/pentaho/di/trans/steps/hl7input/HL7Input.java#L80-L110","documentation":"A catch-all KettleException thrown by HL7Input.processRow() when any exception occurs while parsing the HL7 message and emitting the resulting fields (message type, trigger event, version, description, value). It wraps the original exception (e), so the root cause (often an HL7 v2 parse error from HapiContext/Parser) is in the cause chain.","triggerScenarios":"The content of the configured message field is not a valid HL7 v2 message — e.g. wrong MLLP framing, empty/null field value, malformed segments, or the HL7 parser throws while building the Message model.","commonSituations":"Field contains non-HL7 data (JSON, plain text, truncated message); message split across multiple rows; missing MSH segment; character encoding mismatch garbling segment separators.","solutions":["Inspect the wrapped cause (e.getCause()) to see the exact HL7 parser error","Validate the raw message text (must contain MSH segment and proper \\r segment separators)","Ensure the upstream step delivers one complete HL7 message per row","Filter out null/empty rows before the HL7Input step"],"exampleFix":"// before\nString msg = row[messageFieldIndex]; // may be null\n// after\nif (row[messageFieldIndex] == null || row[messageFieldIndex].toString().trim().isEmpty()) {\n  putRow(outputRowMeta, row); // skip parsing for empty messages\n  continue;\n}","handlingStrategy":"try-catch","validationCode":"String msg = (String) row[idx];\nif (msg == null || !msg.startsWith(\"MSH\")) { logBasic(\"Skipping non-HL7 row\"); return; }","typeGuard":null,"tryCatchPattern":"try { parseHL7(message); } catch (Exception e) { logError(\"HL7 parse failed: \" + e.getCause(), e); /* route row to error stream */ }","preventionTips":["Filter null/empty and non-MSH rows before the HL7Input step","Normalize line separators to \\r for HL7 v2 messages","Always inspect e.getCause() — this message is a generic wrapper","Test messages with an HL7 validator before feeding the transformation"],"tags":["kettle","hl7","parsing","transformation"],"backgroundTag":"json-parse-error","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}