{"record":{"id":"ae51de5f0cbf76d0","repo":"apache/iceberg","slug":"cannot-bind-s-does-not-accept-arguments-ae51de","errorCode":null,"errorMessage":"Cannot bind: %s does not accept arguments","messagePattern":"Cannot bind: (.+?) does not accept arguments","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.1/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.1/spark/src/main/java/org/apache/iceberg/spark/functions/IcebergVersionFunction.java#L20-L56","documentation":"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.","triggerScenarios":"Calling system.iceberg_version('something') or otherwise supplying parameters to the table function.","commonSituations":"Assuming the function takes a catalog or table name argument; copy-pasted call sites from other metadata functions.","solutions":["Call system.iceberg_version() with no arguments","Remove any parameters passed to the function in the SQL or generated query"],"exampleFix":"// before\nSELECT system.iceberg_version('my_catalog') ;\n// after\nSELECT system.iceberg_version();","handlingStrategy":"validation","validationCode":"if (args != null && args.length > 0) {\n  throw new IllegalArgumentException(\"iceberg_version() takes no arguments\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  bound = versionFn.bind(structType);\n} catch (UnsupportedOperationException e) {\n  throw new IllegalArgumentException(\"Remove arguments from iceberg_version()\", e);\n}","preventionTips":["Call iceberg_version() with an empty argument list","Check function signatures in the SQL function registry before invoking","Do not copy argument patterns from other metadata functions"],"tags":["spark","sql-function","arity","version"],"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"}