apache/iceberg · error · NoSuchNamespaceException

Cannot find default warehouse location: namespace %s does no

Error message

Cannot find default warehouse location: namespace %s does not exist

What it means

DynamoDbCatalog.defaultWarehouseLocation() computes the default table location for a new table by looking up the parent namespace's item in DynamoDB and reading its default-location property. If the namespace item does not exist, a NoSuchNamespaceException with this message is thrown, since a warehouse location cannot be derived without it.

Source

Thrown at aws/src/main/java/org/apache/iceberg/aws/dynamodb/DynamoDbCatalog.java:186

  @Override
  protected TableOperations newTableOps(TableIdentifier tableIdentifier) {
    validateTableIdentifier(tableIdentifier);
    return new DynamoDbTableOperations(dynamo, awsProperties, catalogName, fileIO, tableIdentifier);
  }

  @Override
  protected String defaultWarehouseLocation(TableIdentifier tableIdentifier) {
    validateTableIdentifier(tableIdentifier);
    GetItemResponse response =
        dynamo.getItem(
            GetItemRequest.builder()
                .tableName(awsProperties.dynamoDbTableName())
                .consistentRead(true)
                .key(namespacePrimaryKey(tableIdentifier.namespace()))
                .build());

    if (!response.hasItem()) {
      throw new NoSuchNamespaceException(
          "Cannot find default warehouse location: namespace %s does not exist",
          tableIdentifier.namespace());
    }

    String defaultLocationCol = toPropertyCol(PROPERTY_DEFAULT_LOCATION);
    String tableLocation = LocationUtil.tableLocation(tableIdentifier, uniqueTableLocation);
    if (response.item().containsKey(defaultLocationCol)) {
      return String.format("%s/%s", response.item().get(defaultLocationCol).s(), tableLocation);
    } else {
      return String.format(
          "%s/%s.db/%s", warehousePath, tableIdentifier.namespace(), tableLocation);
    }
  }

  @Override
  public void createNamespace(Namespace namespace, Map<String, String> metadata) {
    validateNamespace(namespace);
    Map<String, AttributeValue> values = namespacePrimaryKey(namespace);

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Create the namespace first: catalog.createNamespace(namespace) or pass an explicit `location` property to the table builder so no warehouse lookup is needed.
  2. Verify the catalog is pointing at the intended DynamoDB table and AWS region (s3.table.dynamo-db-table-name, region settings).
  3. Recreate or restore the missing namespace item in the DynamoDB catalog table.

Example fix

// before
catalog.buildTable(TableIdentifier.of("analytics", "events"), schema).create();

// after
if (!catalog.namespaceExists(Namespace.of("analytics"))) {
  catalog.createNamespace(Namespace.of("analytics"));
}
catalog.buildTable(TableIdentifier.of("analytics", "events"), schema).create();
Defensive patterns

Strategy: validation

Validate before calling

DynamoDbCatalog catalog = ...;
Namespace ns = tableIdentifier.namespace();
if (!catalog.namespaceExists(ns)) {
  catalog.createNamespace(ns);
}

Try / catch

try {
  table = catalog.buildTable(id, schema).create();
} catch (NoSuchNamespaceException e) {
  catalog.createNamespace(id.namespace());
  table = catalog.buildTable(id, schema).create();
}

Prevention

When it happens

Trigger: Calling catalog.buildTable(identifier, schema).create() (which invokes location -> defaultWarehouseLocation) when the table's namespace row is absent from the DynamoDB catalog table — e.g. the namespace was never created or was dropped beforehand.

Common situations: Creating a table in a namespace that was never explicitly created via createNamespace; a race where another job dropped the namespace; connecting to the wrong DynamoDB table (s3.table.dynamo-db-table-name) so the namespace lookup finds nothing; region mismatch so reads go to an empty table.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/c6212823649a6959. Report an issue: GitHub.