OtterMind/Chat2DB · error · BusinessException

account.manage.unsupported

account.manage.unsupported

Error message

account.manage.unsupported

What it means

BusinessException code account.manage.unsupported thrown by DbAccountAdminServiceImpl.requireAccountManager when Chat2DBContext.getAccountManager() returns null. Account management (create/drop/alter DB users, grants) is an SPI capability; if no IAccountManager plugin is registered for the current connection's DB type, the feature is unsupported.

Source

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

    @Override
    public List<String> showGrants(String user, String host) {
        return requireAccountManager().showGrants(requireConnection(), user, host);
    }

    @Override
    public AccountPreview preview(AccountOperationRequest command) {
        return requireAccountManager().preview(command);
    }

    @Override
    public AccountExecuteResponse execute(AccountOperationRequest command) {
        return requireAccountManager().execute(requireConnection(), command);
    }

    private IAccountManager requireAccountManager() {
        IAccountManager accountManager = Chat2DBContext.getAccountManager();
        if (accountManager == null) {
            throw new BusinessException("account.manage.unsupported");
        }
        return accountManager;
    }

    private Connection requireConnection() {
        Connection connection = Chat2DBContext.getConnection();
        if (connection == null) {
            throw new BusinessException("connection error");
        }
        return connection;
    }
}

View on GitHub (pinned to 5ee1e990e7)

Solutions

  1. Confirm the target DB type has a registered IAccountManager plugin for your edition.
  2. Use a supported DB type, or manage accounts through the DB's native tooling instead.
  3. If developing a plugin, implement and register an IAccountManager for the dialect and ensure it is on the classpath.

Example fix

// before
account_execute({ dataSourceId, operation: 'CREATE_USER', ... })  // on unsupported DB type

// after: use a supported engine or manage users natively
// (e.g. via psql/mysql CLI on the target DB)
Defensive patterns

Strategy: type-guard

Validate before calling

IAccountManager mgr = Chat2DBContext.getAccountManager();
if (mgr == null) {
    // skip account-management UI / return unsupported for this DB type
    return unsupported("account.manage.unsupported for this DB type");
}

Type guard

public boolean accountManagementSupported() {
    return Chat2DBContext.getAccountManager() != null;
}

Try / catch

try {
    dbAccountAdminService.execute(command);
} catch (BusinessException e) {
    if ("account.manage.unsupported".equals(e.getCode())) {
        return unsupported("Account management is not available for this datasource type");
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling account preview/execute against a datasource whose DB type has no registered IAccountManager implementation in the SPI/plugin layer.

Common situations: DB type that does not support user management through this SPI (e.g. some file/embedded DBs, or engines without a plugin account manager); plugin module not loaded; community edition missing the account-management plugin for that dialect.

Related errors


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