pentaho/pentaho-kettle · error · KettleException

CsvInput.Exception.ErrorPreparingParallelRun

Error message

CsvInput.Exception.ErrorPreparingParallelRun

What it means

prepareToRunInParallel computes file split blocks for parallel CSV reading; any exception in that preparation is wrapped in KettleException with the localized message 'CsvInput.Exception.ErrorPreparingParallelRun' and the cause chained.

Solutions

  1. Read the chained cause for the real failure (usually file access or size lookup)
  2. Verify the CSV file exists and is readable at the time the transformation starts
  3. Disable parallel running (multiple copies) or switch to sequential reading for non-split-safe files
  4. Ensure the file system supports size queries (local/NFS rather than some VFS endpoints)
Defensive patterns

Strategy: validation

Validate before calling

// verify file exists and size is queryable before parallel run
File f = new File(filename);
if (!f.isFile() || f.length() <= 0) throw new KettleException("Cannot read CSV for parallel run: " + filename);

Type guard

boolean isSplitSafe(File f) { return f != null && f.isFile() && f.length() > 0; }

Try / catch

try { prepareToRunInParallel(); }
catch (KettleException e) { logError("Parallel prep failed: " + e.getCause(), e); fallBackToSequential(); }

Prevention

When it happens

Trigger: Invoked from processRow when the CSV step is configured for parallel running (running in multiple copies) and computing file sizes/byte offsets (getFileSize, split calculations) fails.

Common situations: Input file missing or unreadable when sizes are probed, non-local/unsupported file systems that can't report size, character-set issues computing split positions.

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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/csvinput/CsvInput.java:256

          if ( data.startPosition == 0 ) {
            data.bytesToSkipInFirstFile = 0L;
          } else {
            data.bytesToSkipInFirstFile = data.startPosition - totalFileSize;
          }

          break;
        }
        totalFileSize += size;
      }

      if ( data.filenames.length > 0 ) {
        logBasic( BaseMessages.getString(
          PKG, "CsvInput.Log.ParallelFileNrAndPositionFeedback", data.filenames[ data.filenr ], Long
            .toString( data.fileSizes.get( data.filenr ) ), Long.toString( data.bytesToSkipInFirstFile ), Long
            .toString( data.blockToRead ) ) );
      }
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString( PKG, "CsvInput.Exception.ErrorPreparingParallelRun" ), e );
    }
  }

  private void getFilenamesFromPreviousSteps() throws KettleException {
    List<String> filenames = new ArrayList<>();
    boolean firstRow = true;
    int index = -1;
    Object[] row = getRow();
    while ( row != null ) {

      if ( firstRow ) {
        firstRow = false;

        // Get the filename field index...
        //
        String filenameField = environmentSubstitute( meta.getFilenameField() );
        index = getInputRowMeta().indexOfValue( filenameField );
        if ( index < 0 ) {

View on GitHub (pinned to f3058517a1)