{"record":{"id":"eb01fe78d3128cb6","repo":"apache/iceberg","slug":"cannot-load-function-s-s","errorCode":null,"errorMessage":"Cannot load function: %s.%s","messagePattern":"Cannot load function: (.+?)\\.(.+?)","errorType":"exception","errorClass":"NoSuchFunctionException","httpStatus":null,"severity":"error","filePath":"spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SupportsFunctions.java","lineNumber":64,"sourceCode":"      return new Identifier[0];\n    }\n\n    throw new NoSuchNamespaceException(namespace);\n  }\n\n  @Override\n  default UnboundFunction loadFunction(Identifier ident) throws NoSuchFunctionException {\n    String[] namespace = ident.namespace();\n    String name = ident.name();\n\n    if (isFunctionNamespace(namespace)) {\n      UnboundFunction func = SparkFunctions.load(name);\n      if (func != null) {\n        return func;\n      }\n    }\n\n    throw new NoSuchFunctionException(\n        String.format(\"Cannot load function: %s.%s\", name(), ident), Option.empty());\n  }\n}\n","sourceCodeStart":46,"sourceCodeEnd":68,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SupportsFunctions.java#L46-L68","documentation":"Thrown by SupportsFunctions.loadFunction when the requested Iceberg system function cannot be resolved through any of the registered SparkFunctions providers. Iceberg exposes catalog-level functions (e.g. system functions); when none of the function builders can produce an UnboundFunction for the given identifier, this NoSuchFunctionException signals the function does not exist in the catalog.","triggerScenarios":"Calling a catalog function via Spark SQL such as SELECT iceberg.system.some_fn(...) or referencing an Iceberg function in an expression where the identifier (namespace-qualified name) does not match any function registered in SparkFunctions.","commonSituations":"Typo in the function name; using a function that exists in another Iceberg version but not the one on the classpath; qualifying the function with the wrong namespace; expecting engine-builtin functions to be resolvable through the Iceberg function catalog.","solutions":["Check the function name and namespace for typos and verify it against the Iceberg functions supported by your version","Upgrade the Iceberg Spark runtime to a version that registers the desired function","If the logic exists only as a Spark builtin, do not route it through the Iceberg function catalog — call the Spark function directly"],"exampleFix":"// before\nSELECT iceberg.system.mbytes(1);\n// after\nSELECT iceberg.system.mbytes(1048576); -- use a function that exists in the catalog","handlingStrategy":"try-catch","validationCode":"// Verify the function exists before calling\ntry (Functions funcs = Functions.load()) {\n  if (funcs.function(name()) == null) { /* function missing */ }\n}","typeGuard":"boolean functionExists(String ident) { return SparkFunctions.load(ident) != null; }","tryCatchPattern":"try { return supportsFunctions.loadFunction(ident); } catch (NoSuchFunctionException e) { throw new AnalysisException(\"Unknown function: \" + ident, e); }","preventionTips":["Keep a list of supported Iceberg system functions per version and validate identifiers against it","Avoid routing Spark builtins through the Iceberg function catalog","Check the Iceberg release notes when upgrading to see newly registered functions"],"tags":["spark","function-resolution","catalog"],"backgroundTag":"record-not-found","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}