{"record":{"id":"aface693bdcccc17","repo":"pentaho/pentaho-kettle","slug":"textfileinput-log-singlelinefound","errorCode":null,"errorMessage":"TextFileInput.Log.SingleLineFound","messagePattern":"TextFileInput\\.Log\\.SingleLineFound","errorType":"exception","errorClass":"KettleFileException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/csvinput/CsvInput.java","lineNumber":785,"sourceCode":"        // empty column at the end of the row (see the Jira case for details)\n        if ( ( !newLineFound && outputIndex < data.fieldsMapping.size() ) || ( newLineFound && doubleLineEnd ) ) {\n\n          int i = 0;\n          while ( ( !data.newLineFound() && ( i < data.delimiter.length ) ) ) {\n            data.moveEndBufferPointer();\n            i++;\n          }\n\n          switch ( meta.getFileFormatTypeNr() ) {\n            case TextFileInputMeta.FILE_FORMAT_DOS:\n              if ( data.newLineFound() ) {\n                if ( doubleLineEnd == true ) {\n                  data.moveEndBufferPointerXTimes( data.encodingType.getLength() );\n                } else {\n                  //Re-check for a new Line\n                  data.moveEndBufferPointerXTimes( data.encodingType.getLength() );\n                  if ( !data.newLineFound() ) {\n                    throw new KettleFileException( BaseMessages.getString( PKG, \"TextFileInput.Log.SingleLineFound\" ) );\n                  }\n                }\n              }\n              break;\n            case TextFileInputMeta.FILE_FORMAT_MIXED:\n              if ( data.isCarriageReturn() || doubleLineEnd ) {\n                data.moveEndBufferPointerXTimes( data.encodingType.getLength() );\n              }\n              break;\n          }\n        }\n\n        data.setStartBuffer( data.getEndBuffer() );\n      }\n\n      // See if we reached the end of the line.\n      // If not, we need to skip the remaining items on the line until the next newline...\n      //","sourceCodeStart":767,"sourceCodeEnd":803,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/csvinput/CsvInput.java#L767-L803","documentation":"When parsing records that can span multiple lines (e.g. enclosed newlines), after consuming what looks like an end-of-line the parser re-checks for another line feed to distinguish single vs double line endings. If a single line feed is found where the configured format (DOS/Unix double endings context) requires a proper record terminator, a KettleFileException 'SingleLineFound' is thrown because the record structure does not match the configured format.","triggerScenarios":"File format is set to DOS or Unix (not Mixed) and the buffer logic in readOneRow encounters an end-of-line where, after moving the end-buffer pointer, data.newLineFound() is false — i.e. an odd/lonely line ending inconsistent with the configured multi-line record format.","commonSituations":"Mixing CRLF and LF line endings in one file while format is set to DOS; files edited on different OSes; wrong 'File format' selected in the step dialog for the actual file; stray lone CR/LF characters inside the data.","solutions":["Set 'File format' to 'Mixed' in the step dialog if the file contains inconsistent line endings.","Normalize the file's line endings (dos2unix / unix2dos) to match the configured format.","Verify the enclosure and terminator settings; check the raw bytes around the failing line with a hex editor.","Re-save the source file with a single consistent newline style."],"exampleFix":"// before\nfileFormat = \"DOS\"   // file has mixed LF/CRLF\n// after\nfileFormat = \"Mixed\"","handlingStrategy":"validation","validationCode":"// detect mixed line endings before choosing the file format\nbyte[] bytes = java.nio.file.Files.readAllBytes(java.nio.file.Paths.get(filename));\nboolean hasCrlf = new String(bytes).contains(\"\\r\\n\");\nboolean hasLoneLf = new String(bytes).replaceAll(\"\\r\\n\", \"\").contains(\"\\n\");\nif (hasCrlf && hasLoneLf) useFileFormat = \"Mixed\";","typeGuard":null,"tryCatchPattern":"try { ... } catch (KettleFileException e) {\n  logError(\"Line-ending structure mismatch; switch File format to Mixed or normalize the file\", e);\n  setErrors(1);\n}","preventionTips":["Scan files for mixed CRLF/LF before choosing the File format","Use 'Mixed' when files come from multiple sources/OSes","Normalize line endings with dos2unix/unix2dos upstream","Inspect suspicious lines in a hex editor"],"tags":["kettle","pentaho","line-endings","file-format"],"backgroundTag":"invalid-argument-value","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"}