pentaho/pentaho-kettle · error · KettleException
Kitchen.Error.InvalidNumberArgument
Error message
Kitchen.Error.InvalidNumberArgument
What it means
Thrown by Kitchen.parseIntArgument when the value passed to a numeric command-line option (e.g. -maxloglines, -maxlogtimeout) cannot be parsed as an integer. The message comes from the Kitchen messages bundle and includes the option name and the offending value.
Solutions
- Pass an integer value: -maxloglines:1000
- Check shell variables used to build the argument are set and numeric
- Quote arguments properly so spaces/colons do not split the value
- Omit the option to use the default
Example fix
// before
kitchen.sh -file:job.kjb -maxloglines:${UNSET_VAR}
// after
kitchen.sh -file:job.kjb -maxloglines:5000 Defensive patterns
Strategy: validation
Validate before calling
String v = System.getProperty("maxloglines");
if (v != null && !v.matches("-?\\d+")) throw new IllegalArgumentException("-maxloglines must be an integer, got: " + v); Type guard
static boolean isInteger(String s) { return s != null && s.matches("-?\\d+"); } Try / catch
try {
kitchen.main(args);
} catch (KettleException e) {
if (e.getMessage() != null && e.getMessage().contains("InvalidNumberArgument")) {
System.err.println("Usage: kitchen -file:job.kjb -maxloglines:<int>");
}
} Prevention
- Quote all command-line arguments in shell scripts
- Assert environment variables used in arguments are set before launching kitchen
- Add a shell wrapper that regex-checks numeric options
- Prefer omitting numeric options to rely on defaults
When it happens
Trigger: Running kitchen.sh/kitchen.bat with a non-numeric value for -maxloglines or -maxlogtimeout, e.g. `kitchen -file:job.kjb -maxloglines:abc`.
Common situations: Typo in command line; quoting issues causing a truncated or concatenated value; scripts passing empty or placeholder variables like ${MAX_LOGS} that were never set.
Understand the failure class
Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.
Related errors
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/c754f8cd9c98183e.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/kitchen/Kitchen.java:362
maxLogTimeout = Const.toInt( EnvUtil.getSystemProperty( Const.KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES ), 1440 );
}
KettleLogStore.init( maxLogLines, maxLogTimeout );
}
/**
* Parse an argument as an integer.
*
* @param option Command Line Option to parse argument of
* @param def Default if the argument is not set
* @return The parsed argument or the default if the argument was not specified
* @throws KettleException Error parsing provided argument as an integer
*/
protected static int parseIntArgument( final CommandLineOption option, final int def ) throws KettleException {
if ( !Utils.isEmpty( option.getArgument() ) ) {
try {
return Integer.parseInt( option.getArgument().toString() );
} catch ( NumberFormatException ex ) {
throw new KettleException( BaseMessages.getString( PKG, "Kitchen.Error.InvalidNumberArgument", option
.getOption(), option.getArgument() ) );
}
}
return def;
}
private static NamedParams getPluginNamedParam( LogChannelInterface log ) {
NamedParams newNamedParams = new NamedParamsDefault();
try {
for ( CommandLineOptionProvider provider : PluginServiceLoader.loadServices( CommandLineOptionProvider.class ) ) {
newNamedParams = provider.getAdditionalCommandlineOptions( log );
}
} catch ( KettlePluginException e ) {
System.out.println( "Exception getting the named parameters" + e.toString() );
}
return newNamedParams;
}
View on GitHub (pinned to f3058517a1)