{"record":{"id":"7acc896572d38422","repo":"apache/iceberg","slug":"functionnotexistexception","errorCode":null,"errorMessage":"FunctionNotExistException","messagePattern":"FunctionNotExistException","errorType":"exception","errorClass":"FunctionNotExistException","httpStatus":null,"severity":"error","filePath":"flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java","lineNumber":750,"sourceCode":"  @Override\n  public void alterPartition(\n      ObjectPath tablePath,\n      CatalogPartitionSpec partitionSpec,\n      CatalogPartition newPartition,\n      boolean ignoreIfNotExists)\n      throws CatalogException {\n    throw new UnsupportedOperationException();\n  }\n\n  @Override\n  public List<String> listFunctions(String dbName) throws CatalogException {\n    return Collections.emptyList();\n  }\n\n  @Override\n  public CatalogFunction getFunction(ObjectPath functionPath)\n      throws FunctionNotExistException, CatalogException {\n    throw new FunctionNotExistException(getName(), functionPath);\n  }\n\n  @Override\n  public boolean functionExists(ObjectPath functionPath) throws CatalogException {\n    return false;\n  }\n\n  @Override\n  public void createFunction(\n      ObjectPath functionPath, CatalogFunction function, boolean ignoreIfExists)\n      throws CatalogException {\n    throw new UnsupportedOperationException();\n  }\n\n  @Override\n  public void alterFunction(\n      ObjectPath functionPath, CatalogFunction newFunction, boolean ignoreIfNotExists)\n      throws CatalogException {","sourceCodeStart":732,"sourceCodeEnd":768,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java#L732-L768","documentation":"FlinkCatalog registers no functions, so getFunction always throws FunctionNotExistException for any function path. This mirrors the catalog contract: functionExists returns false and listFunctions returns empty. The exception signals the function namespace is entirely unimplemented for Iceberg catalogs.","triggerScenarios":"Calling FlinkCatalog.getFunction(functionPath) for any function, or Flink SQL resolution of a catalog function (not a built-in/temporary function) in a session bound to FlinkCatalog.","commonSituations":"Registering UDFs through the catalog instead of the job; SQL scripts referencing persistent catalog functions after switching the catalog to Iceberg; tooling that enumerates catalog functions.","solutions":["Use Flink's built-in functions or declare UDFs as temporary/system functions in the job (TableEnvironment.createTemporarySystemFunction) instead of catalog functions.","If code may call getFunction, catch FunctionNotExistException and fall back to temporary function resolution.","Register Iceberg transformations in SQL via temporary functions or views, not persistent catalog functions."],"exampleFix":"// before\nCatalogFunction f = catalog.getFunction(new ObjectPath(db, \"my_udf\"));\n// after\ntry {\n  CatalogFunction f = catalog.getFunction(functionPath);\n} catch (FunctionNotExistException e) {\n  tableEnv.createTemporarySystemFunction(\"my_udf\", MyUdf.class);\n}","handlingStrategy":"try-catch","validationCode":"if (catalog instanceof FlinkCatalog) {\n  // no catalog functions exist; resolve UDFs via TableEnvironment instead\n}","typeGuard":"boolean supportsFunctions = !(catalog instanceof FlinkCatalog);","tryCatchPattern":"try {\n  fn = catalog.getFunction(functionPath);\n} catch (FunctionNotExistException e) {\n  fn = tableEnv.getTemporarySystemFunction(functionPath.getObjectName())\n      .orElseThrow(() -> new IllegalStateException(\"Function not registered: \" + functionPath.getObjectName()));\n}","preventionTips":["Register UDFs as temporary/system functions in job bootstrap, never as catalog functions.","Remember listFunctions/functionExists on FlinkCatalog always return empty/false."],"tags":["flink","iceberg","function-not-found","catalog"],"backgroundTag":"resource-not-found","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"}