{"record":{"id":"ca847438c5acd630","repo":"pentaho/pentaho-kettle","slug":"sqlldr-returned-an-error-exit-code","errorCode":null,"errorMessage":"sqlldr returned an error (exit code )","messagePattern":"sqlldr returned an error \\(exit code \\)","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"critical","filePath":"plugins/oracle-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkLoader.java","lineNumber":461,"sourceCode":"      sb.append( \" DIRECT=TRUE\" );\n\n      if ( getStepMeta().getCopies() > 1 || meta.isParallel() ) {\n        sb.append( \" PARALLEL=TRUE\" );\n      }\n    }\n\n    return sb.toString();\n  }\n\n  public void checkExitVal( int exitVal ) throws KettleException {\n    if ( exitVal == EX_SUCC ) {\n      return;\n    }\n\n    if ( meta.isFailOnWarning() && ( exitVal == EX_WARN ) ) {\n      throw new KettleException( \"sqlldr returned warning\" );\n    } else if ( meta.isFailOnError() && ( exitVal != EX_WARN ) ) {\n      throw new KettleException( \"sqlldr returned an error (exit code \" + exitVal + \")\" );\n    }\n  }\n\n  public boolean execute( OraBulkLoaderMeta meta, boolean wait ) throws KettleException {\n    Runtime rt = Runtime.getRuntime();\n\n    try {\n      sqlldrProcess = rt.exec( createCommandLine( meta, true ) );\n      // any error message?\n      StreamLogger errorLogger = new StreamLogger( sqlldrProcess.getErrorStream(), \"ERROR\" );\n\n      // any output?\n      StreamLogger outputLogger = new StreamLogger( sqlldrProcess.getInputStream(), \"OUTPUT\" );\n\n      // kick them off\n      errorLogger.start();\n      outputLogger.start();\n","sourceCodeStart":443,"sourceCodeEnd":479,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/oracle-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkLoader.java#L443-L479","documentation":"Thrown by checkExitVal when sqlldr exits with a code other than EX_SUCC (0) or EX_WARN (2) and failOnError is enabled. The message includes the actual exit code (rendered as empty in this message variant because the code was concatenated at runtime). It means the bulk load failed outright — no useful load occurred.","triggerScenarios":"sqlldr process exits with e.g. 1 (fatal error), 3 or 4 (ORA- errors, OS errors) while meta.isFailOnError() is true; called from execute() after waitFor() or from processRow() for the stream load method.","commonSituations":"Wrong Oracle credentials/SID in the connection; malformed control file; table does not exist or no INSERT privilege; sqlldr binary not on PATH (command exit codes like 127).","solutions":["Check the sqlldr .log file for the underlying ORA- error and fix the database-side cause (credentials, table, privileges)","Verify sqlldr is installed and on PATH for the user running Pentaho (exit code 127/2 from the shell)","Verify the OraBulkLoaderMeta connection settings (host, port, database/SID, user, password)","Keep failOnError=true (default) so failures are surfaced; if exit code came from a transient issue, correct it and re-run"],"exampleFix":"// before\nthrow new KettleException( \"sqlldr returned an error (exit code \" + exitVal + \")\" );\n// after\n// capture and expose the sqlldr log so the real ORA- error is visible\nthrow new KettleException( \"sqlldr returned an error (exit code \" + exitVal + \"), see \" + meta.getLogFile() );","handlingStrategy":"try-catch","validationCode":"// verify prerequisites before the step runs\nassert new java.io.File( sqlldrPath ).exists() || streamCommandOnPath( \"sqlldr\" );\nassert transMeta.findDatabase( connName ) != null;","typeGuard":null,"tryCatchPattern":"try {\n  step.execute( meta, true );\n} catch ( KettleException e ) {\n  java.util.regex.Matcher m = java.util.regex.Pattern.compile( \"exit code (\\\\d+)\" ).matcher( e.getMessage() );\n  if ( m.find() ) {\n    int code = Integer.parseInt( m.group( 1 ) );\n    // 1=fatal, 3=ORACLE errors, 4=OS errors — branch on code\n  }\n}","preventionTips":["Validate Oracle credentials and target table existence before loading","Ensure sqlldr is installed and on PATH for the executing user","Keep failOnError enabled; monitor the sqlldr log file location"],"tags":["oracle","sqlldr","exit-code","database"],"backgroundTag":"http-error-response","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"}