pentaho/pentaho-kettle · error · NoSuchElementException

not present in properties

Error message

 not present in properties

What it means

ConfigReader.getMandatoryProperty() throws NoSuchElementException when the requested key is absent from the properties source. It is the strict accessor: optional properties fall back to defaults, mandatory ones abort with this error naming the missing key.

Solutions

  1. Add the missing property key (named in the exception message) to the configuration source
  2. Check for typos between the key requested and the key defined in the properties file
  3. Verify the properties file is actually on the classpath/path being loaded by ConfigReader
  4. Use getOptionalProperty-style access with a default if the key is legitimately optional

Example fix

// before
String url = reader.getMandatoryProperty( "repovfs.ws.url" ); // NoSuchElementException
// after
String url = System.getProperty( "repovfs.ws.url", "http://localhost:8080/pentaho" );
Properties props = loadProperties( cfgFile ); // ensure key defined
String url2 = reader.getMandatoryProperty( "repovfs.ws.url" );
Defensive patterns

Strategy: validation

Validate before calling

// Check the key before demanding it
if ( !reader.hasProperty( key ) ) { // or probe via optional access
  System.err.println( "Missing mandatory config key: " + key );
}
String val = reader.getMandatoryProperty( key );

Type guard

String safeMandatory( ConfigReader r, String key ) {
  String v = null;
  try { v = r.getMandatoryProperty( key ); } catch ( NoSuchElementException e ) { return null; }
  return v;
}

Try / catch

try {
  String v = reader.getMandatoryProperty( key );
} catch ( NoSuchElementException e ) {
  log.error( "Config key missing: {} - add it to the properties file", e.getMessage() );
}

Prevention

When it happens

Trigger: Calling getMandatoryProperty(key) where propertyGetter.apply(key) returns null - the key was never set in the properties map/file/provider backing the reader.

Common situations: Incomplete repo-vfs-ws configuration (missing URL, user, or password keys); typo in the property key; properties file not loaded or wrong file location; environment-specific config not deployed.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at plugins/repo-vfs/repo-vfs-ws/src/main/java/org/pentaho/di/plugins/repovfs/ws/cfg/ConfigReader.java:58

   * Returns property parsed by given function.
   *
   * @return parsed property or `Optional.empty()` if property not there or
   *         there is a parse error
   */
  public <T> Optional<T> parseProperty( String key, Function<String, T> parser ) {
    try {
      return getProperty( key ).map( parser::apply );
    } catch ( Exception e ) {
      log.error( "Error parsing property {}", key, e );
      return Optional.empty();
    }
  }

  /** Get property or throw */
  public String getMandatoryProperty( String key ) {
    String prop = propertyGetter.apply( key );
    if ( prop == null ) {
      throw new NoSuchElementException( key + " not present in properties" );
    }
    return prop;
  }
}

View on GitHub (pinned to f3058517a1)