{"record":{"id":"019948324d52d232","repo":"OtterMind/Chat2DB","slug":"database-delete-notsupportdbtype","errorCode":"database.delete.notSupportDbType","errorMessage":"database.delete.notSupportDbType","messagePattern":"database\\.delete\\.notSupportDbType","errorType":"validation","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/DbDatabaseObjectDeleteServiceImpl.java","lineNumber":157,"sourceCode":"        } catch (BusinessException e) {\n            throw e;\n        } catch (Exception e) {\n            throw new BusinessException(\"database.delete.executeFailed\", new Object[]{e.getMessage()}, e);\n        }\n    }\n\n    private ConnectionProfile requireCurrentProfile() {\n        ConnectionProfile profile = connectionContextService.currentProfile();\n        if (profile == null) {\n            throw new BusinessException(\"database.delete.invalidDataSource\");\n        }\n        return profile;\n    }\n\n    private String requireSupportedDbType(ConnectionProfile profile) {\n        String dbType = StringUtils.upperCase(StringUtils.trimToNull(profile.getDbType()));\n        if (!SUPPORTED_TYPES.contains(dbType)) {\n            throw new BusinessException(\"database.delete.notSupportDbType\");\n        }\n        return dbType;\n    }\n\n    private void reconnectForDatabaseDelete(String dbType) {\n        if (!DatabaseTypeEnum.POSTGRESQL.name().equalsIgnoreCase(dbType)) {\n            return;\n        }\n        connectionContextService.rebindCurrentDatabase(maintenanceDatabase());\n    }\n\n    private String requireName(String name, String fieldName) {\n        String trimmed = StringUtils.trimToNull(name);\n        if (trimmed == null) {\n            throw new BusinessException(\"database.delete.\" + fieldName + \"Required\");\n        }\n        return trimmed;\n    }","sourceCodeStart":139,"sourceCodeEnd":175,"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/DbDatabaseObjectDeleteServiceImpl.java#L139-L175","documentation":"Thrown by requireSupportedDbType() when the normalized dbType (upper-cased, trimmed) is not in SUPPORTED_TYPES for the delete service. Deletion is only offered for specific dialects.","triggerScenarios":"A delete prepare/execute request runs against a datasource whose dbType is not in the supported set (e.g. a dialect like SQLite, H2, or a less-supported engine that the delete flow does not handle).","commonSituations":"User selects an unsupported datasource type for database/schema deletion; a new dialect plugin registered a type not yet added to SUPPORTED_TYPES; profile.dbType is null/blank (trimToNull yields null, not in the set).","solutions":["Use a supported database type for the delete operation; check SUPPORTED_TYPES for the current allow-list.","If adding dialect support, register the type in SUPPORTED_TYPES and implement dropDatabase/dropSchema in its DbManager.","Ensure profile.getDbType() is non-null and correctly cased."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before delete\nString dbType = StringUtils.upperCase(StringUtils.trimToNull(profile.getDbType()));\nif (dbType == null || !SUPPORTED_TYPES.contains(dbType)) {\n    return Result.fail(\"database.delete.notSupportDbType\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Offer deletion only for dbTypes in SUPPORTED_TYPES.","Ensure profile.getDbType() is non-null and correctly cased.","When adding a dialect, register its type in SUPPORTED_TYPES and implement drop logic."],"tags":["database","delete","db-type","unsupported","validation"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}