pentaho/pentaho-kettle · warning · KettleException

Could not close line number file

Error message

Could not close line number file 

What it means

After reading, initialize() tries to close the reader in a finally block; an IOException from close() is wrapped in this KettleException. This is a cleanup failure, typically indicating an underlying stream/filesystem problem.

Solutions

  1. Check the wrapped IOException cause; often secondary to the primary read error
  2. Verify the file is on a healthy, writable/readable filesystem
  3. Retry the operation after fixing the read error
  4. Consider closing via try-with-resources to surface the original exception

Example fix

// before
// manual finally-close wraps close() IOException
// after
try (BufferedReader reader = ...) { /* read */ } // close errors handled by resource mgmt
Defensive patterns

Strategy: try-catch

Try / catch

try {
  playList = new FilePlayListReplayLineNumberFile(file, lineNumberFile, charset);
} catch (KettleException e) {
  if (e.getMessage().startsWith("Could not close line number file")) {
    log.warn("Non-fatal close failure on line-number file", e.getCause());
  } else throw e;
}

Prevention

When it happens

Trigger: reader.close() throws IOException while releasing the line-number file handle, e.g. underlying VFS stream already broken or OS-level I/O error.

Common situations: VFS file handle already invalidated; disk/permission issue during close; reading exception earlier left the stream in a bad state.

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/d4cb04651b053073. Report an issue: GitHub.

Appendix: source

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

        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)