pentaho/pentaho-kettle · error · KettleException

Could not read line number file

Error message

Could not read line number file 

What it means

FilePlayListReplayLineNumberFile.initialize() reads a line-number file (used in replay/play-list mode to skip previously processed lines) and wraps any parsing/IO exception in this KettleException. Reading errors can also come from non-numeric line content.

Solutions

  1. Verify the line-number file exists and is readable at the given URI
  2. Check each line contains only a numeric line number
  3. Regenerate the line-number file from the previous run
  4. Check filesystem permissions on the file

Example fix

// before
// lines like "12abc" in linenumber.txt
// after
// linenumber.txt contains one long per line: 12\n45\n
Defensive patterns

Strategy: validation

Validate before calling

// Validate the line-number file before constructing the play-list replay object
FileObject f = KettleVFS.getInstance(DefaultBowl.getInstance()).getFileObject(lineNumberUri);
if (!f.exists() || !f.isReadable()) throw new IllegalStateException("Line number file missing/unreadable");
try (BufferedReader r = new BufferedReader(new InputStreamReader(f.getContent().getInputStream()))) {
  String line;
  while ((line = r.readLine()) != null)
    if (line.length() > 0) Long.parseLong(line.trim()); // throws if non-numeric
}

Try / catch

try {
  playList = new FilePlayListReplayLineNumberFile(file, lineNumberFile, charset);
} catch (KettleException e) {
  if (e.getMessage().startsWith("Could not read line number file")) {
    log.error("Bad or missing replay line-number file: ", e.getCause());
  } else throw e;
}

Prevention

When it happens

Trigger: Constructor passes a lineNumberFile that cannot be read: missing file, permission problem, or content that fails Long.valueOf parsing.

Common situations: Replay file corrupted or truncated; file deleted between runs; wrong file passed as the line-number file; encoding/BOM causing parse failure.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/5c30a3a0dd67682e. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/core/playlist/FilePlayListReplayLineNumberFile.java:52

  }

  private void initialize( FileObject lineNumberFile, String encoding ) throws KettleException {
    BufferedReader reader = null;
    try {
      if ( encoding == null ) {
        reader = new BufferedReader( new InputStreamReader( KettleVFS.getInputStream( lineNumberFile ) ) );
      } else {
        reader =
          new BufferedReader( new InputStreamReader( KettleVFS.getInputStream( lineNumberFile ), encoding ) );
      }
      String line = null;
      while ( ( line = reader.readLine() ) != null ) {
        if ( line.length() > 0 ) {
          lineNumbers.add( Long.valueOf( line ) );
        }
      }
    } catch ( Exception e ) {
      throw new KettleException( "Could not read line number file " + lineNumberFile.getName().getURI(), e );
    } finally {
      if ( reader != null ) {
        try {
          reader.close();
        } catch ( IOException e ) {
          throw new KettleException( "Could not close line number file " + lineNumberFile.getName().getURI(), e );
        }
      }
    }
  }

  public boolean isProcessingNeeded( FileObject file, long lineNr, String filePart ) throws KettleException {
    return lineNumbers.contains( new Long( lineNr ) );
  }
}

View on GitHub (pinned to f3058517a1)