{"record":{"id":"6142f72e96d9b4a9","repo":"apache/iceberg","slug":"cannot-bind-name-does-not-accept-arguments-6142f7","errorCode":null,"errorMessage":"Cannot bind: ${name()} does not accept arguments","messagePattern":"Cannot bind: (.+?) does not accept arguments","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/functions/IcebergVersionFunction.java","lineNumber":38,"sourceCode":"\nimport org.apache.iceberg.IcebergBuild;\nimport org.apache.spark.sql.catalyst.InternalRow;\nimport org.apache.spark.sql.connector.catalog.functions.BoundFunction;\nimport org.apache.spark.sql.connector.catalog.functions.UnboundFunction;\nimport org.apache.spark.sql.types.DataType;\nimport org.apache.spark.sql.types.DataTypes;\nimport org.apache.spark.sql.types.StructType;\nimport org.apache.spark.unsafe.types.UTF8String;\n\n/**\n * A function for use in SQL that returns the current Iceberg version, e.g. {@code SELECT\n * system.iceberg_version()} will return a String such as \"0.14.0\" or \"0.15.0-SNAPSHOT\"\n */\npublic class IcebergVersionFunction implements UnboundFunction {\n  @Override\n  public BoundFunction bind(StructType inputType) {\n    if (inputType.fields().length > 0) {\n      throw new UnsupportedOperationException(\n          String.format(\"Cannot bind: %s does not accept arguments\", name()));\n    }\n\n    return new IcebergVersionFunctionImpl();\n  }\n\n  @Override\n  public String description() {\n    return name() + \" - Returns the runtime Iceberg version\";\n  }\n\n  @Override\n  public String name() {\n    return \"iceberg_version\";\n  }\n\n  // Implementing class cannot be private, otherwise Spark is unable to access the static invoke\n  // function during code-gen and calling the function fails","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/functions/IcebergVersionFunction.java#L20-L56","documentation":"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.","triggerScenarios":"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().","commonSituations":"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.","solutions":["Call it with no arguments: SELECT iceberg_version().","Remove any extra arguments from the call.","If you need table metadata, query the table's metadata log or system tables instead.","Check the function's description via DESCRIBE FUNCTION iceberg_version."],"exampleFix":"// before\nSELECT iceberg_version(NULL) FROM t\n// after\nSELECT iceberg_version()","handlingStrategy":"validation","validationCode":"// Spark SQL — call with zero arguments\nSELECT iceberg_version();\n// or programmatically, ensure arg list is empty\nval args: Seq[Column] = Seq.empty","typeGuard":null,"tryCatchPattern":"try {\n  spark.sql(\"SELECT iceberg_version()\")\n} catch {\n  case e: UnsupportedOperationException if e.getMessage.contains(\"does not accept arguments\") =>\n    spark.sql(\"SELECT iceberg_version()\") // retry with zero args\n}","preventionTips":["iceberg_version() takes no arguments — never pass NULL or literals","Run DESCRIBE FUNCTION iceberg_version to confirm the signature","Remove leftover arguments when copying similar version/metadata functions","Use table metadata queries (e.g. metadata_log_entries) for per-table info instead"],"tags":["spark","sql-function","arity","system-function"],"backgroundTag":"missing-required-argument","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}