apache/iceberg · error · java.lang.UnsupportedOperationException

Cannot bind: ${name()} does not accept arguments

Error message

Cannot bind: ${name()} does not accept arguments

What it means

Iceberg's iceberg_version() system function takes no arguments. It reports the Iceberg runtime version as a string. Calling it with any argument — even a NULL literal — fails binding with this UnsupportedOperationException naming the function. Thrown during query analysis.

Source

Thrown at spark/v4.2/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 it with no arguments: SELECT iceberg_version().
  2. Remove any extra arguments from the call.
  3. If you need table metadata, query the table's metadata log or system tables instead.
  4. Check the function's description via DESCRIBE FUNCTION iceberg_version.

Example fix

// before
SELECT iceberg_version(NULL) FROM t
// after
SELECT iceberg_version()
Defensive patterns

Strategy: validation

Validate before calling

// Spark SQL — call with zero arguments
SELECT iceberg_version();
// or programmatically, ensure arg list is empty
val args: Seq[Column] = Seq.empty

Try / catch

try {
  spark.sql("SELECT iceberg_version()")
} catch {
  case e: UnsupportedOperationException if e.getMessage.contains("does not accept arguments") =>
    spark.sql("SELECT iceberg_version()") // retry with zero args
}

Prevention

When it happens

Trigger: Calling iceberg_version('x'), iceberg_version(NULL), or iceberg_version(some_col) with one or more arguments instead of the zero-argument form iceberg_version().

Common situations: Confusing iceberg_version() with similar version functions that take arguments; copy-pasted SQL with leftover arguments; mistakenly expecting it to compare or report a table's version.

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/6142f72e96d9b4a9. Report an issue: GitHub.