apache/iceberg · error · IllegalArgumentException

Unsupported lock type

Error message

Unsupported lock type: %s 

What it means

LockFactoryBuilder builds a TriggerLockFactory for the Iceberg Flink maintenance (rewrite) service based on the configured lock type (JDBC, ZooKeeper, or noop). This IllegalArgumentException is thrown when the lock type extracted from the LockConfig is none of the supported values. It indicates the table property or config that selects the lock implementation was set to an unknown value.

Solutions

  1. Check the configured lock type value and correct the typo — valid values are the constants on LockConfig (NOOP, JDBC, ZK).
  2. Verify the Iceberg Flink version: ensure the lock type you use exists in that version (e.g. zk support present).
  3. If no external lock is desired, explicitly configure the NOOP lock type rather than leaving an unrecognized value.

Example fix

// before
lock.type = "zookeeper"
// after
lock.type = "zk"
Defensive patterns

Strategy: validation

Validate before calling

Set<String> valid = Set.of(LockConfig.NoopLockConfig.NOOP, LockConfig.JdbcLockConfig.JDBC, LockConfig.ZkLockConfig.ZK);
if (!valid.contains(lockType)) {
  throw new IllegalArgumentException("lock type must be one of " + valid + ", got: " + lockType);
}

Prevention

When it happens

Trigger: Calling LockFactoryBuilder.build(lockConfig, tableName) where lockConfig.lockType() returns something other than LockConfig.NoopLockConfig.NOOP, JdbcLockConfig.JDBC, or ZkLockConfig.ZK, e.g. after misspelling the lock type or using a custom/raw string in the maintenance lock configuration.

Common situations: Typos in the lock config value, copying config from an older Iceberg version where lock type names differed, or programmatically constructing LockConfig with an unmanaged enum/string value.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/f35b5e68524ce132. Report an issue: GitHub.

Appendix: source

Thrown at flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/maintenance/operator/LockFactoryBuilder.java:53

  public static TriggerLockFactory build(LockConfig lockConfig, String tableName) {

    String lockType = lockConfig.lockType();

    Preconditions.checkArgument(
        StringUtils.isNotEmpty(lockType),
        "Configuration must contain key: %s",
        LockConfig.LOCK_TYPE_OPTION.key());

    // Set lock id to catalog.db.table if not set
    switch (lockType) {
      case LockConfig.JdbcLockConfig.JDBC:
        return createJdbcLockFactory(lockConfig, tableName);

      case LockConfig.ZkLockConfig.ZK:
        return createZkLockFactory(lockConfig, tableName);

      default:
        throw new IllegalArgumentException(String.format("Unsupported lock type: %s ", lockType));
    }
  }

  private static TriggerLockFactory createJdbcLockFactory(LockConfig lockConfig, String tableName) {
    String jdbcUri = lockConfig.jdbcUri();
    String lockId = lockConfig.lockId(tableName);
    Map<String, String> properties = lockConfig.properties();
    Preconditions.checkArgument(
        StringUtils.isNotEmpty(jdbcUri),
        "JDBC lock requires %s parameter",
        LockConfig.JdbcLockConfig.JDBC_URI_OPTION.key());

    properties.put(JdbcLockFactory.INIT_LOCK_TABLES_PROPERTY, lockConfig.jdbcInitTable());

    return new JdbcLockFactory(jdbcUri, lockId, properties);
  }

  private static TriggerLockFactory createZkLockFactory(LockConfig lockConfig, String tableName) {

View on GitHub (pinned to 86d9c8fc54)