{"record":{"id":"c754f8cd9c98183e","repo":"pentaho/pentaho-kettle","slug":"kitchen-error-invalidnumberargument","errorCode":null,"errorMessage":"Kitchen.Error.InvalidNumberArgument","messagePattern":"Kitchen\\.Error\\.InvalidNumberArgument","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/kitchen/Kitchen.java","lineNumber":362,"sourceCode":"      maxLogTimeout = Const.toInt( EnvUtil.getSystemProperty( Const.KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES ), 1440 );\n    }\n    KettleLogStore.init( maxLogLines, maxLogTimeout );\n  }\n\n  /**\n   * Parse an argument as an integer.\n   *\n   * @param option Command Line Option to parse argument of\n   * @param def    Default if the argument is not set\n   * @return The parsed argument or the default if the argument was not specified\n   * @throws KettleException Error parsing provided argument as an integer\n   */\n  protected static int parseIntArgument( final CommandLineOption option, final int def ) throws KettleException {\n    if ( !Utils.isEmpty( option.getArgument() ) ) {\n      try {\n        return Integer.parseInt( option.getArgument().toString() );\n      } catch ( NumberFormatException ex ) {\n        throw new KettleException( BaseMessages.getString( PKG, \"Kitchen.Error.InvalidNumberArgument\", option\n          .getOption(), option.getArgument() ) );\n      }\n    }\n    return def;\n  }\n\n  private static NamedParams getPluginNamedParam( LogChannelInterface log ) {\n    NamedParams newNamedParams = new NamedParamsDefault();\n    try {\n      for ( CommandLineOptionProvider provider : PluginServiceLoader.loadServices( CommandLineOptionProvider.class ) ) {\n        newNamedParams = provider.getAdditionalCommandlineOptions( log );\n      }\n    } catch ( KettlePluginException e ) {\n      System.out.println( \"Exception getting the named parameters\" + e.toString() );\n    }\n    return newNamedParams;\n  }\n","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/kitchen/Kitchen.java#L344-L380","documentation":"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.","triggerScenarios":"Running kitchen.sh/kitchen.bat with a non-numeric value for -maxloglines or -maxlogtimeout, e.g. `kitchen -file:job.kjb -maxloglines:abc`.","commonSituations":"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.","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"],"exampleFix":"// before\nkitchen.sh -file:job.kjb -maxloglines:${UNSET_VAR}\n// after\nkitchen.sh -file:job.kjb -maxloglines:5000","handlingStrategy":"validation","validationCode":"String v = System.getProperty(\"maxloglines\");\nif (v != null && !v.matches(\"-?\\\\d+\")) throw new IllegalArgumentException(\"-maxloglines must be an integer, got: \" + v);","typeGuard":"static boolean isInteger(String s) { return s != null && s.matches(\"-?\\\\d+\"); }","tryCatchPattern":"try {\n  kitchen.main(args);\n} catch (KettleException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"InvalidNumberArgument\")) {\n    System.err.println(\"Usage: kitchen -file:job.kjb -maxloglines:<int>\");\n  }\n}","preventionTips":["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"],"tags":["cli","argument-parsing","kitchen"],"backgroundTag":"invalid-cli-argument","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"}