{"record":{"id":"d4cb04651b053073","repo":"pentaho/pentaho-kettle","slug":"could-not-close-line-number-file","errorCode":null,"errorMessage":"Could not close line number file ","messagePattern":"Could not close line number file ","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"warning","filePath":"engine/src/main/java/org/pentaho/di/core/playlist/FilePlayListReplayLineNumberFile.java","lineNumber":58,"sourceCode":"        reader = new BufferedReader( new InputStreamReader( KettleVFS.getInputStream( lineNumberFile ) ) );\n      } else {\n        reader =\n          new BufferedReader( new InputStreamReader( KettleVFS.getInputStream( lineNumberFile ), encoding ) );\n      }\n      String line = null;\n      while ( ( line = reader.readLine() ) != null ) {\n        if ( line.length() > 0 ) {\n          lineNumbers.add( Long.valueOf( line ) );\n        }\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( \"Could not read line number file \" + lineNumberFile.getName().getURI(), e );\n    } finally {\n      if ( reader != null ) {\n        try {\n          reader.close();\n        } catch ( IOException e ) {\n          throw new KettleException( \"Could not close line number file \" + lineNumberFile.getName().getURI(), e );\n        }\n      }\n    }\n  }\n\n  public boolean isProcessingNeeded( FileObject file, long lineNr, String filePart ) throws KettleException {\n    return lineNumbers.contains( new Long( lineNr ) );\n  }\n}\n","sourceCodeStart":40,"sourceCodeEnd":68,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/core/playlist/FilePlayListReplayLineNumberFile.java#L40-L68","documentation":"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.","triggerScenarios":"reader.close() throws IOException while releasing the line-number file handle, e.g. underlying VFS stream already broken or OS-level I/O error.","commonSituations":"VFS file handle already invalidated; disk/permission issue during close; reading exception earlier left the stream in a bad state.","solutions":["Check the wrapped IOException cause; often secondary to the primary read error","Verify the file is on a healthy, writable/readable filesystem","Retry the operation after fixing the read error","Consider closing via try-with-resources to surface the original exception"],"exampleFix":"// before\n// manual finally-close wraps close() IOException\n// after\ntry (BufferedReader reader = ...) { /* read */ } // close errors handled by resource mgmt","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  playList = new FilePlayListReplayLineNumberFile(file, lineNumberFile, charset);\n} catch (KettleException e) {\n  if (e.getMessage().startsWith(\"Could not close line number file\")) {\n    log.warn(\"Non-fatal close failure on line-number file\", e.getCause());\n  } else throw e;\n}","preventionTips":["Treat close failures as symptoms of an earlier I/O problem and fix the root cause","Run on healthy local filesystems rather than flaky network mounts for replay files","Keep the KettleVFS cache clean to avoid stale handles"],"tags":["file-io","resource-cleanup"],"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"}