apache/iceberg · error · NoSuchNamespaceException
invalid input for namespace %s, error message: %s
Error message
invalid input for namespace %s, error message: %s
What it means
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.
Source
Thrown at aws/src/main/java/org/apache/iceberg/aws/glue/GlueCatalog.java:546
.name(databaseName)
.build())
.database();
Map<String, String> result = Maps.newHashMap(database.parameters());
if (database.locationUri() != null) {
result.put(
IcebergToGlueConverter.GLUE_DB_LOCATION_KEY,
LocationUtil.stripTrailingSlash(database.locationUri()));
}
if (database.description() != null) {
result.put(IcebergToGlueConverter.GLUE_DESCRIPTION_KEY, database.description());
}
LOG.debug("Loaded metadata for namespace {} found {}", namespace, result);
return result;
} catch (InvalidInputException e) {
throw new NoSuchNamespaceException(
"invalid input for namespace %s, error message: %s", namespace, e.getMessage());
} catch (EntityNotFoundException e) {
throw new NoSuchNamespaceException(
"fail to find Glue database for namespace %s, error message: %s",
databaseName, e.getMessage());
}
}
@Override
public boolean dropNamespace(Namespace namespace) throws NamespaceNotEmptyException {
namespaceExists(namespace);
GetTablesResponse response =
glue.getTables(
GetTablesRequest.builder()
.catalogId(awsProperties.glueCatalogId())
.databaseName(
IcebergToGlueConverter.toDatabaseName(View on GitHub (pinned to 86d9c8fc54)
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.
Example fix
// before
catalog.loadNamespaceMetadata(Namespace.of("My Schema!"));
// after
String db = "My Schema!".trim().toLowerCase(Locale.ROOT).replaceAll("[^a-z0-9_]", "_");
catalog.loadNamespaceMetadata(Namespace.of(db)); Defensive patterns
Strategy: validation
Validate before calling
String name = ns.level(0);
if (!name.matches("^[a-z0-9_]{1,255}$")) {
throw new IllegalArgumentException("Invalid Glue database name: " + name);
} Try / catch
try {
return catalog.loadNamespaceMetadata(ns);
} catch (NoSuchNamespaceException e) {
LOG.error("Invalid or missing namespace {}: {}", ns, e.getMessage());
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Cannot create namespace %s because it already exists in Glue
- Glue does not support nested namespace, cannot list namespac
- fail to find Glue database for namespace %s, error message:
- Cannot drop namespace %s because it still contains Iceberg t
- Cannot drop namespace %s because it still contains non-Icebe
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/995785bb524e5743.
Report an issue: GitHub.