hibernate/hibernate-orm · error · IllegalArgumentException

Passed table name cannot be null

Error message

Passed table name cannot be null

What it means

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.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/DatabaseInformationImpl.java:113

	@Override
	public TableInformation getTableInformation(
			Identifier catalogName,
			Identifier schemaName,
			Identifier tableName) {
		return getTableInformation( new QualifiedTableName( catalogName, schemaName, tableName ) );
	}

	@Override
	public TableInformation getTableInformation(
			Namespace.Name namespace,
			Identifier tableName) {
		return getTableInformation( new QualifiedTableName( namespace, tableName ) );
	}

	@Override
	public TableInformation getTableInformation(QualifiedTableName tableName) {
		if ( tableName.getObjectName() == null ) {
			throw new IllegalArgumentException( "Passed table name cannot be null" );
		}
		return extractor.getTable(
				context.catalogWithDefault( tableName.getCatalogName() ),
				context.schemaWithDefault( tableName.getSchemaName() ),
				tableName.getTableName()
		);
	}

	@Override
	public NameSpaceTablesInformation getTablesInformation(Namespace namespace) {
		return extractor.getTables( context.catalogWithDefault( namespace.getPhysicalName().catalog() ),
				context.schemaWithDefault( namespace.getPhysicalName().schema() ) );
	}

	@Override
	public SequenceInformation getSequenceInformation(
			Identifier catalogName,
			Identifier schemaName,

View on GitHub (pinned to fad1729dce)

Solutions

  1. Null-check the table identifier before building QualifiedTableName and fail fast with your own message.
  2. Derive identifiers explicitly via Identifier.toIdentifier("...") from known constants instead of passing through possibly-null config values.
  3. Validate configuration-derived names at startup (fail boot with a clear message) rather than deep inside extraction.

Example fix

// before: tableName may be null from configuration and is passed through
TableInformation info = databaseInformation.getTableInformation(
        new QualifiedTableName(catalog, schema, tableName));

// after: fail fast with a clear message before calling the API
if (tableName == null || tableName.getText() == null) {
    throw new IllegalArgumentException("table name is required for schema extraction");
}
TableInformation info = databaseInformation.getTableInformation(
        new QualifiedTableName(catalog, schema, tableName));
Defensive patterns

Strategy: validation

Validate before calling

// Validate before calling DatabaseInformation.getTableInformation(...)
if (tableName == null || tableName.getText() == null) {
    throw new IllegalArgumentException("table name is required for schema extraction: " + mappingContext);
}

Type guard

static boolean hasTableName(org.hibernate.tool.schema.extract.spi.QualifiedTableName name) {
    return name != null && name.getObjectName() != null;
}

Try / catch

try {
    info = databaseInformation.getTableInformation(qualified);
} catch (IllegalArgumentException e) {
    if ("Passed table name cannot be null".equals(e.getMessage())) {
        // caller bug: fix the argument source (config/map lookup), do not retry
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/8d04777555bc2f06. Report an issue: GitHub.