{"record":{"id":"3746e57284bc39e4","repo":"apache/iceberg","slug":"database-properties-should-not-contain-key-comme-3746e5","errorCode":null,"errorMessage":"Database properties should not contain key: 'comment'.","messagePattern":"Database properties should not contain key: 'comment'\\.","errorType":"exception","errorClass":"CatalogException","httpStatus":null,"severity":"error","filePath":"flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java","lineNumber":240,"sourceCode":"      throws DatabaseAlreadyExistException, CatalogException {\n    if (asNamespaceCatalog != null) {\n      try {\n        asNamespaceCatalog.createNamespace(appendLevel(baseNamespace, databaseName), metadata);\n      } catch (AlreadyExistsException e) {\n        if (!ignoreIfExists) {\n          throw new DatabaseAlreadyExistException(getName(), databaseName, e);\n        }\n      }\n    } else {\n      throw new UnsupportedOperationException(\n          \"Namespaces are not supported by catalog: \" + getName());\n    }\n  }\n\n  private Map<String, String> mergeComment(Map<String, String> metadata, String comment) {\n    Map<String, String> ret = Maps.newHashMap(metadata);\n    if (metadata.containsKey(\"comment\")) {\n      throw new CatalogException(\"Database properties should not contain key: 'comment'.\");\n    }\n\n    if (!StringUtils.isNullOrWhitespaceOnly(comment)) {\n      ret.put(\"comment\", comment);\n    }\n    return ret;\n  }\n\n  @Override\n  public void dropDatabase(String name, boolean ignoreIfNotExists, boolean cascade)\n      throws DatabaseNotExistException, DatabaseNotEmptyException, CatalogException {\n    if (asNamespaceCatalog != null) {\n      try {\n        boolean success = asNamespaceCatalog.dropNamespace(appendLevel(baseNamespace, name));\n        if (!success && !ignoreIfNotExists) {\n          throw new DatabaseNotExistException(getName(), name);\n        }\n      } catch (NoSuchNamespaceException e) {","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java#L222-L258","documentation":"mergeComment rejects database properties that already contain the reserved key 'comment', because Flink passes the database comment both as a property and as an explicit comment parameter; keeping it in the property map would create a conflict. The library throws CatalogException to force the caller to remove 'comment' from metadata before merging the explicit comment.","triggerScenarios":"Calling createDatabase(name, metadata, comment) or newProperties with a properties map that includes key \"comment\", typically when copying properties from an existing Hive/Spark database.","commonSituations":"Migrating databases from Hive Metastore where 'comment' is stored as a property; generic tooling that passes through arbitrary database metadata without filtering reserved keys.","solutions":["Remove the 'comment' key from the properties map before calling createDatabase","Pass the comment via the dedicated comment parameter instead of as a property","Filter reserved keys generically before submitting database metadata"],"exampleFix":"// before\ncatalog.createDatabase(\"db\", Map.of(\"comment\", \"hello\"), null);\n// after\nMap<String, String> props = new HashMap<>(metadata);\nprops.remove(\"comment\");\ncatalog.createDatabase(\"db\", props, \"hello\");","handlingStrategy":"validation","validationCode":"if (metadata.containsKey(\"comment\")) {\n  throw new IllegalArgumentException(\"Remove reserved 'comment' key before createDatabase\");\n}","typeGuard":"null","tryCatchPattern":"try { catalog.createDatabase(name, metadata, comment); } catch (CatalogException e) { /* remove 'comment' key and retry once */ }","preventionTips":["Strip reserved keys (comment) from database properties before submission","Pass comments via the dedicated comment parameter","Filter metadata when migrating from Hive/Spark catalogs"],"tags":["flink","iceberg-catalog","reserved-property","validation"],"backgroundTag":"conflicting-config-options","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}