pentaho/pentaho-kettle · error · IllegalArgumentException

Entry not found [key= ]

Error message

Entry not found [key={key}]

What it means

KeyValueSet.getRequired throws IllegalArgumentException when the requested key has no entry in the set. It is the strict variant of get(): unlike get(), which returns null for missing keys, getRequired() guarantees a non-null KeyValue or throws. It exists so callers can safely dereference the result without a null check.

Solutions

  1. Verify the exact key string matches the key used when the entry was added (spelling and case).
  2. Call set.get(key) and check for null first, or use contains(key), when absence is a legitimate state.
  3. If the key should always exist, add it to the set at initialization before any getRequired() call.
  4. Wrap in try-catch (IllegalArgumentException) when reading external/user-supplied key sets.

Example fix

// before
KeyValue<?> val = set.getRequired("porta");
// after
KeyValue<?> val = set.get("port") != null ? set.get("port") : set.getRequired("port");
Defensive patterns

Strategy: validation

Validate before calling

if (set.get("myKey") == null) {
  throw new IllegalStateException("Key 'myKey' must be set before use");
}
KeyValue<?> v = set.getRequired("myKey");

Type guard

KeyValue<?> kv = set.get(key);
if (kv == null) {
  return null; // handle absence explicitly
}

Try / catch

try {
  KeyValue<?> kv = set.getRequired(key);
  use(kv);
} catch (IllegalArgumentException e) {
  log.warn("Missing entry: " + e.getMessage());
}

Prevention

When it happens

Trigger: Calling getRequired(key) with a key that was never added to the KeyValueSet, or after the entry was removed, or with a key whose spelling/case differs from the stored key.

Common situations: Typo in a property/parameter key name; reading a key that only exists in newer versions of a plugin or metadata file; case-sensitivity mismatches between where keys are written and where they are read.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/core/util/KeyValueSet.java:103

   * @return matching key values.
   * @throws IllegalArgumentException
   *           if filter is null.
   */
  public List<KeyValue<?>> get( final Predicate filter ) throws IllegalArgumentException {
    final AddClosureArrayList<KeyValue<?>> result = new AddClosureArrayList<KeyValue<?>>();
    this.walk( result, filter );
    return result;
  }

  /**
   * @param key
   *          the key.
   * @return key value, never null.
   */
  public KeyValue<?> getRequired( final String key ) {
    final KeyValue<?> keyValue = this.get( key );
    if ( keyValue == null ) {
      throw new IllegalArgumentException( "Entry not found [key=" + key + "]" );
    }
    return keyValue;
  }

  /**
   * @return keys.
   */
  public List<String> keys() {
    return new ArrayList<String>( this.entries.keySet() );
  }

  /**
   * @return key values/entries.
   */
  public List<KeyValue<?>> keyValues() {
    return new ArrayList<KeyValue<?>>( this.entries.values() );
  }

View on GitHub (pinned to f3058517a1)