{"record":{"id":"03fc7fb5063ec9fa","repo":"pentaho/pentaho-kettle","slug":"not-present-in-properties","errorCode":null,"errorMessage":" not present in properties","messagePattern":" not present in properties","errorType":"exception","errorClass":"NoSuchElementException","httpStatus":null,"severity":"error","filePath":"plugins/repo-vfs/repo-vfs-ws/src/main/java/org/pentaho/di/plugins/repovfs/ws/cfg/ConfigReader.java","lineNumber":58,"sourceCode":"   * Returns property parsed by given function.\n   *\n   * @return parsed property or `Optional.empty()` if property not there or\n   *         there is a parse error\n   */\n  public <T> Optional<T> parseProperty( String key, Function<String, T> parser ) {\n    try {\n      return getProperty( key ).map( parser::apply );\n    } catch ( Exception e ) {\n      log.error( \"Error parsing property {}\", key, e );\n      return Optional.empty();\n    }\n  }\n\n  /** Get property or throw */\n  public String getMandatoryProperty( String key ) {\n    String prop = propertyGetter.apply( key );\n    if ( prop == null ) {\n      throw new NoSuchElementException( key + \" not present in properties\" );\n    }\n    return prop;\n  }\n}\n","sourceCodeStart":40,"sourceCodeEnd":63,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/repo-vfs/repo-vfs-ws/src/main/java/org/pentaho/di/plugins/repovfs/ws/cfg/ConfigReader.java#L40-L63","documentation":"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.","triggerScenarios":"Calling getMandatoryProperty(key) where propertyGetter.apply(key) returns null - the key was never set in the properties map/file/provider backing the reader.","commonSituations":"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.","solutions":["Add the missing property key (named in the exception message) to the configuration source","Check for typos between the key requested and the key defined in the properties file","Verify the properties file is actually on the classpath/path being loaded by ConfigReader","Use getOptionalProperty-style access with a default if the key is legitimately optional"],"exampleFix":"// before\nString url = reader.getMandatoryProperty( \"repovfs.ws.url\" ); // NoSuchElementException\n// after\nString url = System.getProperty( \"repovfs.ws.url\", \"http://localhost:8080/pentaho\" );\nProperties props = loadProperties( cfgFile ); // ensure key defined\nString url2 = reader.getMandatoryProperty( \"repovfs.ws.url\" );","handlingStrategy":"validation","validationCode":"// Check the key before demanding it\nif ( !reader.hasProperty( key ) ) { // or probe via optional access\n  System.err.println( \"Missing mandatory config key: \" + key );\n}\nString val = reader.getMandatoryProperty( key );","typeGuard":"String safeMandatory( ConfigReader r, String key ) {\n  String v = null;\n  try { v = r.getMandatoryProperty( key ); } catch ( NoSuchElementException e ) { return null; }\n  return v;\n}","tryCatchPattern":"try {\n  String v = reader.getMandatoryProperty( key );\n} catch ( NoSuchElementException e ) {\n  log.error( \"Config key missing: {} - add it to the properties file\", e.getMessage() );\n}","preventionTips":["Ship a documented, complete properties template with all mandatory keys","Validate all mandatory keys at startup with a fail-fast loop","Match key names exactly (typos are the top cause)","Verify the properties file is present and loaded in each environment"],"tags":["configuration","missing-property","nosuchelement"],"backgroundTag":"missing-required-config-field","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"}