{"record":{"id":"e57075f9c969eaa7","repo":"apache/iceberg","slug":"invalid-table-identifier-s","errorCode":null,"errorMessage":"Invalid table identifier: %s","messagePattern":"Invalid table identifier: (.+?)","errorType":"exception","errorClass":"NoSuchTableException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/BaseMetastoreCatalog.java","lineNumber":66,"sourceCode":"      TableOperations ops = newTableOps(identifier);\n      if (ops.current() == null) {\n        // the identifier may be valid for both tables and metadata tables\n        if (isValidMetadataIdentifier(identifier)) {\n          result = loadMetadataTable(identifier);\n\n        } else {\n          throw new NoSuchTableException(\"Table does not exist: %s\", identifier);\n        }\n\n      } else {\n        result = new BaseTable(ops, fullTableName(name(), identifier), metricsReporter());\n      }\n\n    } else if (isValidMetadataIdentifier(identifier)) {\n      result = loadMetadataTable(identifier);\n\n    } else {\n      throw new NoSuchTableException(\"Invalid table identifier: %s\", identifier);\n    }\n\n    LOG.info(\"Table loaded by catalog: {}\", result);\n    return result;\n  }\n\n  @Override\n  public Table registerTable(TableIdentifier identifier, String metadataFileLocation) {\n    Preconditions.checkArgument(\n        identifier != null && isValidIdentifier(identifier), \"Invalid identifier: %s\", identifier);\n    Preconditions.checkArgument(\n        metadataFileLocation != null && !metadataFileLocation.isEmpty(),\n        \"Cannot register an empty metadata file location as a table\");\n\n    // Throw an exception if this table already exists in the catalog.\n    if (tableExists(identifier)) {\n      throw new AlreadyExistsException(\"Table already exists: %s\", identifier);\n    }","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/BaseMetastoreCatalog.java#L48-L84","documentation":"When loading a table whose identifier is not valid for the catalog (and not a valid metadata identifier), the catalog reports it as NoSuchTableException with 'Invalid table identifier'. It fires on the branch where the identifier itself cannot denote a table in this catalog, e.g. an empty/invalid name for the catalog's namespace handling.","triggerScenarios":"loadTable with an identifier whose name is invalid (e.g. empty name) or whose namespace cannot form a valid table identifier for this catalog, and which is not a metadata-table name.","commonSituations":"Programmatic identifier construction producing empty names; mixing catalogs with different namespace semantics (e.g. nested namespaces on a two-level Hive metastore).","solutions":["Validate the TableIdentifier (non-empty namespace levels and name) before calling loadTable","Ensure the namespace depth matches the catalog's expected hierarchy","Use the correct catalog instance for the namespace layout"],"exampleFix":"// before\nTableIdentifier bad = TableIdentifier.of(namespace); // name missing\nTable t = catalog.loadTable(bad);\n// after\nValidationException.check(!name.isEmpty(), \"Table name required\");\nTableIdentifier ident = TableIdentifier.of(namespace, name);\nTable t = catalog.loadTable(ident);","handlingStrategy":"validation","validationCode":"ValidationException.check(identifier != null && !identifier.name().isEmpty() && identifier.namespace().levels().length > 0, \"Invalid identifier: \" + identifier);","typeGuard":"boolean isValid(TableIdentifier id) { return id != null && !id.name().isEmpty() && id.namespace().levels().length > 0; }","tryCatchPattern":"try { return catalog.loadTable(ident); } catch (NoSuchTableException e) { throw new IllegalArgumentException(\"Bad table identifier: \" + ident, e); }","preventionTips":["Build identifiers with TableIdentifier.of using explicit name and namespace","Match namespace depth to the catalog's metastore layout","Add identifier validation at application boundaries"],"tags":["catalog","identifier","no-such-table"],"backgroundTag":"invalid-identifier","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"}