{"record":{"id":"98ff764350267822","repo":"pentaho/pentaho-kettle","slug":"unable-to-read-row-from-file","errorCode":null,"errorMessage":"Unable to read row from file","messagePattern":"Unable to read row from file","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/getfilesrowscount/GetFilesRowsCount.java","lineNumber":84,"sourceCode":"        r = RowDataUtil.allocateRowData( data.outputRowMeta.size() );\n      }\n\n      if ( meta.isSmartCount() && data.foundData ) {\n        // We have data right the last separator,\n        // we need to update the row count\n        data.rownr++;\n      }\n\n      r[data.totalpreviousfields] = data.rownr;\n\n      if ( meta.includeCountFiles() ) {\n        r[data.totalpreviousfields + 1] = data.filenr;\n      }\n\n      incrementLinesInput();\n\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to read row from file\", e );\n    }\n\n    return r;\n  }\n\n  public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException {\n\n    try {\n      // Grab one row\n      Object[] outputRowData = getOneRow();\n      if ( outputRowData == null ) {\n        setOutputDone(); // signal end to receiver(s)\n        return false; // end of data or error.\n      }\n      if ( ( !meta.isFileField() && data.last_file ) || meta.isFileField() ) {\n        putRow( data.outputRowMeta, outputRowData ); // copy row to output rowset(s);\n        if ( log.isDetailed() ) {\n          logDetailed(","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/getfilesrowscount/GetFilesRowsCount.java#L66-L102","documentation":"GetFilesRowsCount.getOneRow() wraps any exception while reading the next count/filename values from the currently open file into a KettleException with message 'Unable to read row from file'. It signals the row for the current input file could not be produced, so the step aborts processing.","triggerScenarios":"Called from outputRowData via getOneRow when getRowNumber() throws (malformed row-number field format, IO error reading the file) or building output row r fails (row meta mismatch).","commonSituations":"File deleted or locked between open and read; configured 'rows count field' value in the file is not parseable as the target type; wrong charset causing garbage values.","solutions":["Check the file is readable, not locked, and still exists at processing time.","Verify the configured rows-count field/format matches the file content (e.g. numeric).","Confirm file encoding setting matches the actual file charset.","Inspect the wrapped cause to identify which field or IO step failed."],"exampleFix":"// before\nvalue = Long.parseLong( line ); // NumberFormatException wrapped as this error\n// after\ntry { value = Long.parseLong( line.trim() ); } catch (NumberFormatException nfe) { logBasic(\"Skipping non-numeric count line: \" + line); }","handlingStrategy":"try-catch","validationCode":"File f = new File(space.environmentSubstitute(fileName)); if (!f.canRead()) throw new KettleException(\"File not readable: \" + f);","typeGuard":null,"tryCatchPattern":"try { row = getOneRow(); } catch (KettleException e) { log.error(\"Unable to read row from file: \" + e.getMessage(), e.getCause()); setErrors(1); stopAll(); }","preventionTips":["Confirm file readability before running the transformation","Match the encoding setting to the actual file charset","Validate the rows-count field format against file content","Preview the step to catch parse issues early"],"tags":["kettle","file-read","row-parsing"],"backgroundTag":"file-read-failed","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"}