pentaho/pentaho-kettle · error · KettleException

sqlldr returned warning

Error message

sqlldr returned warning

What it means

This error is thrown by checkExitVal when the sqlldr (Oracle SQL*Loader) child process exits with code EX_WARN (typically 2, indicating rows loaded with warnings/rejects) and the step is configured with failOnWarning=true. The step lets you decide whether such a partial-success exit should abort the transformation. It signals that data was loaded but some issues occurred (e.g. rejected rows, bad file records).

Solutions

  1. Inspect the sqlldr log / bad file (.bad, .log) written by the step to find rejected rows and fix the source data
  2. Set failOnWarning=false on the OraBulkLoaderMeta if warnings should not abort the transformation
  3. Fix the table definition (constraints, column sizes) to accept the incoming data
  4. Add error handling in the transformation (e.g. error handling on the step) and re-run

Example fix

// before
meta.setFailOnWarning( true );
// after
// tolerate warning exit code 2 and inspect the sqlldr bad file instead
meta.setFailOnWarning( false );
Defensive patterns

Strategy: validation

Validate before calling

// before running the transformation
if ( meta.isFailOnWarning() ) {
  System.out.println( "sqlldr warnings will fail the step; ensure data is clean" );
}

Try / catch

try {
  step.processRow( smi, sdi );
} catch ( KettleException e ) {
  if ( e.getMessage().contains( "sqlldr returned warning" ) ) {
    // inspect .bad/.log files and decide whether to re-run with failOnWarning=false
  }
}

Prevention

When it happens

Trigger: sqlldr exits with exit code 2 (EX_WARN) while meta.isFailOnWarning() is true; checkExitVal is called from execute() after wait, and from processRow() when the 'wait for database stream' load method finishes the process.

Common situations: Records rejected due to constraint violations, data type mismatches or too-long values; sqlldr configuration quirks (e.g. direct=true warnings); running the step after changing failOnWarning to true while data still contains bad rows.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


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

Appendix: source

Thrown at plugins/oracle-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkLoader.java:459

    if ( meta.isDirectPath() ) {
      sb.append( " DIRECT=TRUE" );

      if ( getStepMeta().getCopies() > 1 || meta.isParallel() ) {
        sb.append( " PARALLEL=TRUE" );
      }
    }

    return sb.toString();
  }

  public void checkExitVal( int exitVal ) throws KettleException {
    if ( exitVal == EX_SUCC ) {
      return;
    }

    if ( meta.isFailOnWarning() && ( exitVal == EX_WARN ) ) {
      throw new KettleException( "sqlldr returned warning" );
    } else if ( meta.isFailOnError() && ( exitVal != EX_WARN ) ) {
      throw new KettleException( "sqlldr returned an error (exit code " + exitVal + ")" );
    }
  }

  public boolean execute( OraBulkLoaderMeta meta, boolean wait ) throws KettleException {
    Runtime rt = Runtime.getRuntime();

    try {
      sqlldrProcess = rt.exec( createCommandLine( meta, true ) );
      // any error message?
      StreamLogger errorLogger = new StreamLogger( sqlldrProcess.getErrorStream(), "ERROR" );

      // any output?
      StreamLogger outputLogger = new StreamLogger( sqlldrProcess.getInputStream(), "OUTPUT" );

      // kick them off
      errorLogger.start();

View on GitHub (pinned to f3058517a1)