{"record":{"id":"995785bb524e5743","repo":"apache/iceberg","slug":"invalid-input-for-namespace-s-error-message-s","errorCode":null,"errorMessage":"invalid input for namespace %s, error message: %s","messagePattern":"invalid input for namespace (.+?), error message: (.+?)","errorType":"exception","errorClass":"NoSuchNamespaceException","httpStatus":null,"severity":"error","filePath":"aws/src/main/java/org/apache/iceberg/aws/glue/GlueCatalog.java","lineNumber":546,"sourceCode":"                      .name(databaseName)\n                      .build())\n              .database();\n      Map<String, String> result = Maps.newHashMap(database.parameters());\n\n      if (database.locationUri() != null) {\n        result.put(\n            IcebergToGlueConverter.GLUE_DB_LOCATION_KEY,\n            LocationUtil.stripTrailingSlash(database.locationUri()));\n      }\n\n      if (database.description() != null) {\n        result.put(IcebergToGlueConverter.GLUE_DESCRIPTION_KEY, database.description());\n      }\n\n      LOG.debug(\"Loaded metadata for namespace {} found {}\", namespace, result);\n      return result;\n    } catch (InvalidInputException e) {\n      throw new NoSuchNamespaceException(\n          \"invalid input for namespace %s, error message: %s\", namespace, e.getMessage());\n    } catch (EntityNotFoundException e) {\n      throw new NoSuchNamespaceException(\n          \"fail to find Glue database for namespace %s, error message: %s\",\n          databaseName, e.getMessage());\n    }\n  }\n\n  @Override\n  public boolean dropNamespace(Namespace namespace) throws NamespaceNotEmptyException {\n    namespaceExists(namespace);\n\n    GetTablesResponse response =\n        glue.getTables(\n            GetTablesRequest.builder()\n                .catalogId(awsProperties.glueCatalogId())\n                .databaseName(\n                    IcebergToGlueConverter.toDatabaseName(","sourceCodeStart":528,"sourceCodeEnd":564,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/aws/src/main/java/org/apache/iceberg/aws/glue/GlueCatalog.java#L528-L564","documentation":"GlueCatalog.loadNamespaceMetadata catches Glue's InvalidInputException while calling GetDatabase and rethrows it as NoSuchNamespaceException with the AWS error message appended. Glue returns InvalidInputException when the database name is malformed or fails Glue's name validation rules (length, allowed characters), so the namespace identifier passed to Iceberg is not a valid Glue database name.","triggerScenarios":"Calling catalog.loadNamespaceMetadata(ns) where the namespace contains characters Glue disallows (special characters, too long, empty segments); passing a multi-level namespace when Glue expects one level; names created by engines with looser validation rules.","commonSituations":"Namespaces copied from other catalogs (Hive/Hadoop) with unsupported characters; programmatic namespace generation producing invalid identifiers; typos such as trailing dots or whitespace in configuration.","solutions":["Validate the namespace against Glue database naming rules (lowercase letters, numbers, underscore; max length) before calling the catalog.","Strip or normalize illegal characters in the namespace string before use.","Ensure the Namespace has exactly one level; flatten hierarchical names.","Read the AWS error message in the exception — it names the exact validation Glue rejected."],"exampleFix":"// before\ncatalog.loadNamespaceMetadata(Namespace.of(\"My Schema!\"));\n\n// after\nString db = \"My Schema!\".trim().toLowerCase(Locale.ROOT).replaceAll(\"[^a-z0-9_]\", \"_\");\ncatalog.loadNamespaceMetadata(Namespace.of(db));","handlingStrategy":"validation","validationCode":"String name = ns.level(0);\nif (!name.matches(\"^[a-z0-9_]{1,255}$\")) {\n  throw new IllegalArgumentException(\"Invalid Glue database name: \" + name);\n}","typeGuard":null,"tryCatchPattern":"try {\n  return catalog.loadNamespaceMetadata(ns);\n} catch (NoSuchNamespaceException e) {\n  LOG.error(\"Invalid or missing namespace {}: {}\", ns, e.getMessage());\n  throw e;\n}","preventionTips":["Validate namespace strings against Glue naming rules before catalog calls","Normalize case and strip whitespace/special characters from identifiers","Keep namespaces single-level when targeting Glue"],"tags":["aws","glue","namespace","invalid-input","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"}