OtterMind/Chat2DB · error · BusinessException

database.delete.confirmNameMismatch

database.delete.confirmNameMismatch

Error message

database.delete.confirmNameMismatch

What it means

Thrown by assertConfirmName when the user-supplied confirmName does not exactly equal the expected confirm name (which is the database or schema name itself). This is the typed-confirmation safety gate for destructive DROP operations — the user must type the exact object name to proceed. Fires in executeDatabaseDelete and executeSchemaDelete, not in prepare.

Source

Thrown at chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/db/DbDatabaseObjectDeleteServiceImpl.java:268

        List<Schema> schemas = Chat2DBContext.getDbMetaData().schemas(connection, databaseName);
        boolean exists = schemas != null && schemas.stream()
                .anyMatch(schema -> StringUtils.equals(schema.getName(), schemaName));
        if (!exists) {
            throw new BusinessException("database.delete.schemaNotExists");
        }
    }

    private String schemaConfirmName(String schemaName) {
        return schemaName;
    }

    private String buildDropSchema(String dbType, String schemaName) {
        return Chat2DBContext.getDbMetaData(dbType).getSqlBuilder().ddl().schema().buildDropSchema(schemaName);
    }

    private void assertConfirmName(String actualConfirmName, String expectedConfirmName) {
        if (!StringUtils.equals(actualConfirmName, expectedConfirmName)) {
            throw new BusinessException("database.delete.confirmNameMismatch");
        }
    }

    private String maintenanceDatabase() {
        return "postgres";
    }
}

View on GitHub (pinned to 5ee1e990e7)

Solutions

  1. Pass the exact database or schema name as confirmName with no extra whitespace.
  2. Trim the confirmName in the UI before submitting, but note the check is case-sensitive.
  3. Re-run prepare to obtain the confirmName and echo it back exactly in execute.

Example fix

// before
executeDatabaseDelete(DbDatabaseObjectDeleteExecuteRequest.builder()
    .databaseName("mydb")
    .confirmName("MyDB")  // case mismatch
    .build());

// after
executeDatabaseDelete(DbDatabaseObjectDeleteExecuteRequest.builder()
    .databaseName("mydb")
    .confirmName("mydb")  // exact match
    .build());
Defensive patterns

Strategy: validation

Validate before calling

// Before calling execute, ensure confirmName exactly equals the object name
if (!StringUtils.equals(param.getConfirmName(), expectedName)) {
    // block submission; show the exact required name to the user
}

Prevention

When it happens

Trigger: Calling executeDatabaseDelete or executeSchemaDelete where param.getConfirmName() does not StringUtils.equals the actual database/schema name. Even a trailing space or different case fails the check (exact equals, case-sensitive).

Common situations: User mistypes the confirmation name; UI sends an empty or stale confirmName; copy-paste introduces whitespace; case mismatch between displayed name and typed input.

Related errors


AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14). Data as JSON: /api/errors/5ef3894fab850606. Report an issue: GitHub.