{"record":{"id":"8d04777555bc2f06","repo":"hibernate/hibernate-orm","slug":"passed-table-name-cannot-be-null","errorCode":null,"errorMessage":"Passed table name cannot be null","messagePattern":"Passed table name cannot be null","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/DatabaseInformationImpl.java","lineNumber":113,"sourceCode":"\t@Override\n\tpublic TableInformation getTableInformation(\n\t\t\tIdentifier catalogName,\n\t\t\tIdentifier schemaName,\n\t\t\tIdentifier tableName) {\n\t\treturn getTableInformation( new QualifiedTableName( catalogName, schemaName, tableName ) );\n\t}\n\n\t@Override\n\tpublic TableInformation getTableInformation(\n\t\t\tNamespace.Name namespace,\n\t\t\tIdentifier tableName) {\n\t\treturn getTableInformation( new QualifiedTableName( namespace, tableName ) );\n\t}\n\n\t@Override\n\tpublic TableInformation getTableInformation(QualifiedTableName tableName) {\n\t\tif ( tableName.getObjectName() == null ) {\n\t\t\tthrow new IllegalArgumentException( \"Passed table name cannot be null\" );\n\t\t}\n\t\treturn extractor.getTable(\n\t\t\t\tcontext.catalogWithDefault( tableName.getCatalogName() ),\n\t\t\t\tcontext.schemaWithDefault( tableName.getSchemaName() ),\n\t\t\t\ttableName.getTableName()\n\t\t);\n\t}\n\n\t@Override\n\tpublic NameSpaceTablesInformation getTablesInformation(Namespace namespace) {\n\t\treturn extractor.getTables( context.catalogWithDefault( namespace.getPhysicalName().catalog() ),\n\t\t\t\tcontext.schemaWithDefault( namespace.getPhysicalName().schema() ) );\n\t}\n\n\t@Override\n\tpublic SequenceInformation getSequenceInformation(\n\t\t\tIdentifier catalogName,\n\t\t\tIdentifier schemaName,","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/DatabaseInformationImpl.java#L95-L131","documentation":"IllegalArgumentException from DatabaseInformationImpl.getTableInformation(QualifiedTableName): the table-name component of the qualified name is null. In the extraction API, catalog and schema may legitimately be null (defaults are applied via context.catalogWithDefault/schemaWithDefault), but the table identifier may not. This is an argument-contract violation in the calling code, not a database state problem.","triggerScenarios":"Calling DatabaseInformation.getTableInformation(...) - directly or via the (Namespace.Name, Identifier) overload that delegates to it - with a QualifiedTableName built as new QualifiedTableName(catalog, schema, null) or a null Identifier tableName. Happens in custom schema-tooling code, tests, or integrations that hand-assemble QualifiedTableName from configuration values that were missing or blank.","commonSituations":"Custom SchemaManagementToolCoordinator or extractor wrappers; table names read from config/maps where a missing entry silently yields null; refactors that reorder the (catalog, schema, table) constructor arguments.","solutions":["Null-check the table identifier before building QualifiedTableName and fail fast with your own message.","Derive identifiers explicitly via Identifier.toIdentifier(\"...\") from known constants instead of passing through possibly-null config values.","Validate configuration-derived names at startup (fail boot with a clear message) rather than deep inside extraction."],"exampleFix":"// before: tableName may be null from configuration and is passed through\nTableInformation info = databaseInformation.getTableInformation(\n        new QualifiedTableName(catalog, schema, tableName));\n\n// after: fail fast with a clear message before calling the API\nif (tableName == null || tableName.getText() == null) {\n    throw new IllegalArgumentException(\"table name is required for schema extraction\");\n}\nTableInformation info = databaseInformation.getTableInformation(\n        new QualifiedTableName(catalog, schema, tableName));","handlingStrategy":"validation","validationCode":"// Validate before calling DatabaseInformation.getTableInformation(...)\nif (tableName == null || tableName.getText() == null) {\n    throw new IllegalArgumentException(\"table name is required for schema extraction: \" + mappingContext);\n}","typeGuard":"static boolean hasTableName(org.hibernate.tool.schema.extract.spi.QualifiedTableName name) {\n    return name != null && name.getObjectName() != null;\n}","tryCatchPattern":"try {\n    info = databaseInformation.getTableInformation(qualified);\n} catch (IllegalArgumentException e) {\n    if (\"Passed table name cannot be null\".equals(e.getMessage())) {\n        // caller bug: fix the argument source (config/map lookup), do not retry\n    }\n    throw e;\n}","preventionTips":["Never construct QualifiedTableName with a literal null table component; derive names via Identifier.toIdentifier","Validate configuration-derived table names at application startup with a clear error message","Wrap external input feeding schema APIs behind a small facade that rejects blank names"],"tags":["hibernate","schema-management","illegal-argument","null-check","api-contract"],"backgroundTag":"null-argument","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}