{"record":{"id":"680e292addfda3f3","repo":"apache/iceberg","slug":"database-properties-should-not-contain-key-comme-680e29","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.2/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.2/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java#L222-L258","documentation":"mergeComment rejects metadata maps that already contain the reserved key 'comment' with CatalogException \"Database properties should not contain key: 'comment'.\" The comment is stored separately by Flink, so passing it inside properties would create a conflict that Iceberg/Flink resolves by refusing the operation.","triggerScenarios":"createDatabase(name, metadata) or alterDatabase (via newProperties/mergeComment) where the user-supplied properties map contains key 'comment', which Flink treats as the database comment field rather than an ordinary property.","commonSituations":"Copying namespace metadata (e.g. from another catalog's output) without stripping 'comment'; hand-written DDL like CREATE DATABASE x WITH ('comment'='...') where the connector expects comment as a separate option.","solutions":["Remove the 'comment' key from the properties map before calling createDatabase/alterDatabase","Pass the comment through the dedicated mechanism (Flink DDL COMMENT clause / CatalogDatabase comment) instead of as a property","Strip reserved keys when copying metadata programmatically"],"exampleFix":"// before\nMap<String, String> props = Maps.newHashMap(sourceProps); // contains 'comment'\ncatalog.createDatabase(\"db\", props);\n// after\nMap<String, String> props = Maps.newHashMap(sourceProps);\nprops.remove(\"comment\");\ncatalog.createDatabase(\"db\", props);","handlingStrategy":"validation","validationCode":"if (props.containsKey(\"comment\")) { throw new IllegalArgumentException(\"Remove 'comment' from properties; pass it as the database comment\"); }","typeGuard":null,"tryCatchPattern":"try { catalog.alterDatabase(name, newDatabase, false); } catch (CatalogException e) { if (e.getMessage().contains(\"comment\")) { /* strip key and retry */ } }","preventionTips":["Strip reserved keys ('comment') when copying namespace metadata between catalogs","Use the DDL COMMENT clause instead of a 'comment' property","Centralize a sanitizeProps() helper for all catalog property maps"],"tags":["flink","catalog","reserved-key","validation"],"backgroundTag":"invalid-argument-value","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"}