pentaho/pentaho-kettle · error · KettleException
GPLoad.Exception.MaxErrorsInvalid
Error message
GPLoad.Exception.MaxErrorsInvalid
What it means
GPLoad validates the ERROR_LIMIT (max errors) setting while emitting the control file. If the value parses as an integer but is negative, this exception is thrown because gpload's ERROR_LIMIT must be >= 0.
Solutions
- Set Max Errors to a non-negative integer (0 typically means unlimited for gpload) in the step dialog.
- Check the value of any ${MAX_ERRORS}-style environment variable at runtime.
- Correct the value in kettle.properties or the job variable configuration.
- Programmatically use meta.setMaxErrors("0") or a positive count.
Example fix
// before
meta.setMaxErrors("-1"); // throws GPLoad.Exception.MaxErrorsInvalid
// after
meta.setMaxErrors("0"); // 0 = unlimited, or e.g. "100" Defensive patterns
Strategy: validation
Validate before calling
String maxErrors = meta.getMaxErrors();
try {
if (maxErrors != null && Integer.parseInt(maxErrors.trim()) < 0) {
throw new IllegalArgumentException("Max errors must be >= 0");
}
} catch (NumberFormatException nfe) {
throw new IllegalArgumentException("Max errors must be an integer", nfe);
} Try / catch
try {
step.createControlFile(meta);
} catch (KettleException e) {
if (e.getMessage().contains("MaxErrorsInvalid")) { /* reset Max Errors to a valid integer */ }
else throw e;
} Prevention
- Enter plain non-negative integers only; use 0 for unlimited.
- Never use -1 as a sentinel in this field.
- If driven by a variable, validate the variable value in a prior step.
- Test the dialog's YAML output after changing numeric fields.
When it happens
Trigger: getControlFileContents called with meta.getMaxErrors() non-null, environment-substituted, and Integer.valueOf(maxErrors) < 0.
Common situations: User typed -1 intending 'unlimited'; an environment variable like ${MAX_ERRORS} resolves to a negative number; pasted value with a minus sign by mistake.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- GPload.Exception.DataFileMissing
- GPload.Exception.DelimiterMissing
- GPLoad.Exception.MatchColumnsNeeded
- GPLoad.Exception.NoControlFileSpecified
- GPLoad.Exception.UpdateColumnsNeeded
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/08f6e30976aed20f.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/gpload/core/src/main/java/org/pentaho/di/trans/steps/gpload/GPLoad.java:317
contents.append( GPLoad.INDENT ).append( "- QUOTE: " ).append( GPLoad.SINGLE_QUOTE ).append( enclosure ).append(
GPLoad.SINGLE_QUOTE ).append( Const.CR );
contents.append( GPLoad.INDENT ).append( "- HEADER: FALSE" ).append( Const.CR );
// ENCODING
String encoding = meta.getEncoding();
if ( !Utils.isEmpty( encoding ) ) {
contents.append( GPLoad.INDENT ).append( "- ENCODING: " ).append( encoding ).append( Const.CR );
}
// Max errors
String maxErrors = meta.getMaxErrors();
if ( maxErrors == null ) {
maxErrors = GPLoadMeta.MAX_ERRORS_DEFAULT;
} else {
maxErrors = environmentSubstitute( maxErrors );
try {
if ( Integer.valueOf( maxErrors ) < 0 ) {
throw new KettleException( BaseMessages.getString( PKG, "GPLoad.Exception.MaxErrorsInvalid" ) );
}
} catch ( NumberFormatException nfe ) {
throw new KettleException( BaseMessages.getString( PKG, "GPLoad.Exception.MaxErrorsInvalid" ) );
}
}
contents.append( GPLoad.INDENT ).append( "- ERROR_LIMIT: " ).append( maxErrors ).append( Const.CR );
String errorTableName = meta.getErrorTableName();
if ( !Utils.isEmpty( errorTableName ) ) {
errorTableName = environmentSubstitute( errorTableName ).trim();
if ( !Utils.isEmpty( errorTableName ) ) {
contents.append( GPLoad.INDENT ).append( "- ERROR_TABLE: " ).append( errorTableName ).append( Const.CR );
}
}
// -------------- OUTPUT section
View on GitHub (pinned to f3058517a1)