{"record":{"id":"f049a3aaf388f3ca","repo":"OtterMind/Chat2DB","slug":"account-manage-unsupported","errorCode":"account.manage.unsupported","errorMessage":"account.manage.unsupported","messagePattern":"account\\.manage\\.unsupported","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/db/DbAccountAdminServiceImpl.java","lineNumber":54,"sourceCode":"    @Override\n    public List<String> showGrants(String user, String host) {\n        return requireAccountManager().showGrants(requireConnection(), user, host);\n    }\n\n    @Override\n    public AccountPreview preview(AccountOperationRequest command) {\n        return requireAccountManager().preview(command);\n    }\n\n    @Override\n    public AccountExecuteResponse execute(AccountOperationRequest command) {\n        return requireAccountManager().execute(requireConnection(), command);\n    }\n\n    private IAccountManager requireAccountManager() {\n        IAccountManager accountManager = Chat2DBContext.getAccountManager();\n        if (accountManager == null) {\n            throw new BusinessException(\"account.manage.unsupported\");\n        }\n        return accountManager;\n    }\n\n    private Connection requireConnection() {\n        Connection connection = Chat2DBContext.getConnection();\n        if (connection == null) {\n            throw new BusinessException(\"connection error\");\n        }\n        return connection;\n    }\n}\n","sourceCodeStart":36,"sourceCodeEnd":67,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/db/DbAccountAdminServiceImpl.java#L36-L67","documentation":"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.","triggerScenarios":"Calling account preview/execute against a datasource whose DB type has no registered IAccountManager implementation in the SPI/plugin layer.","commonSituations":"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.","solutions":["Confirm the target DB type has a registered IAccountManager plugin for your edition.","Use a supported DB type, or manage accounts through the DB's native tooling instead.","If developing a plugin, implement and register an IAccountManager for the dialect and ensure it is on the classpath."],"exampleFix":"// before\naccount_execute({ dataSourceId, operation: 'CREATE_USER', ... })  // on unsupported DB type\n\n// after: use a supported engine or manage users natively\n// (e.g. via psql/mysql CLI on the target DB)","handlingStrategy":"type-guard","validationCode":"IAccountManager mgr = Chat2DBContext.getAccountManager();\nif (mgr == null) {\n    // skip account-management UI / return unsupported for this DB type\n    return unsupported(\"account.manage.unsupported for this DB type\");\n}","typeGuard":"public boolean accountManagementSupported() {\n    return Chat2DBContext.getAccountManager() != null;\n}","tryCatchPattern":"try {\n    dbAccountAdminService.execute(command);\n} catch (BusinessException e) {\n    if (\"account.manage.unsupported\".equals(e.getCode())) {\n        return unsupported(\"Account management is not available for this datasource type\");\n    }\n    throw e;\n}","preventionTips":["Gate account-management UI/actions on accountManagementSupported() per datasource type.","Ensure the dialect's account-management plugin is on the classpath for your edition.","Fall back to native DB tooling for unsupported engines."],"tags":["account-management","spi","plugin","unsupported"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}