apache/iceberg · error · UnsupportedOperationException

Cannot bind: %s does not accept arguments

Error message

Cannot bind: %s does not accept arguments

What it means

Arity guard in IcebergVersionFunction.bind: system.iceberg_version() takes no arguments, so any input schema with arguments is refused at bind time. The %s is the function/description naming the zero-argument contract.

Source

Thrown at spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/functions/IcebergVersionFunction.java:38

import org.apache.iceberg.IcebergBuild;
import org.apache.spark.sql.catalyst.InternalRow;
import org.apache.spark.sql.connector.catalog.functions.BoundFunction;
import org.apache.spark.sql.connector.catalog.functions.UnboundFunction;
import org.apache.spark.sql.types.DataType;
import org.apache.spark.sql.types.DataTypes;
import org.apache.spark.sql.types.StructType;
import org.apache.spark.unsafe.types.UTF8String;

/**
 * A function for use in SQL that returns the current Iceberg version, e.g. {@code SELECT
 * system.iceberg_version()} will return a String such as "0.14.0" or "0.15.0-SNAPSHOT"
 */
public class IcebergVersionFunction implements UnboundFunction {
  @Override
  public BoundFunction bind(StructType inputType) {
    if (inputType.fields().length > 0) {
      throw new UnsupportedOperationException(
          String.format("Cannot bind: %s does not accept arguments", name()));
    }

    return new IcebergVersionFunctionImpl();
  }

  @Override
  public String description() {
    return name() + " - Returns the runtime Iceberg version";
  }

  @Override
  public String name() {
    return "iceberg_version";
  }

  // Implementing class cannot be private, otherwise Spark is unable to access the static invoke
  // function during code-gen and calling the function fails

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Call system.iceberg_version() with no arguments
  2. Remove any parameters passed to the function in the SQL or generated query

Example fix

// before
SELECT system.iceberg_version('my_catalog') ;
// after
SELECT system.iceberg_version();
Defensive patterns

Strategy: validation

Validate before calling

if (args != null && args.length > 0) {
  throw new IllegalArgumentException("iceberg_version() takes no arguments");
}

Try / catch

try {
  bound = versionFn.bind(structType);
} catch (UnsupportedOperationException e) {
  throw new IllegalArgumentException("Remove arguments from iceberg_version()", e);
}

Prevention

When it happens

Trigger: Calling system.iceberg_version('something') or otherwise supplying parameters to the table function.

Common situations: Assuming the function takes a catalog or table name argument; copy-pasted call sites from other metadata functions.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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