{"record":{"id":"8b7578f8fcfb6e75","repo":"OtterMind/Chat2DB","slug":"routine-operation-onlymysqlsupported","errorCode":"routine.operation.onlyMysqlSupported","errorMessage":"routine.operation.onlyMysqlSupported","messagePattern":"routine\\.operation\\.onlyMysqlSupported","errorType":"exception","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/DbRoutineOperationServiceImpl.java","lineNumber":25,"sourceCode":"import ai.chat2db.community.tools.exception.BusinessException;\nimport ai.chat2db.spi.IRoutineManager;\nimport ai.chat2db.spi.model.datasource.ConnectInfo;\nimport ai.chat2db.spi.sql.Chat2DBContext;\nimport org.apache.commons.lang3.StringUtils;\nimport org.springframework.stereotype.Service;\n\nimport java.sql.Connection;\n\n@Service\npublic class DbRoutineOperationServiceImpl implements IDbRoutineOperationService {\n\n    @Override\n    public SqlPreview previewInvocation(RoutineOperation operation) {\n        IRoutineManager routineManager = Chat2DBContext.getRoutineManager();\n        if (routineManager == null) {\n            throw new BusinessException(\"routine.operation.onlyMysqlSupported\");\n        }\n        Connection connection = Chat2DBContext.getConnection();\n        if (connection == null) {\n            throw new BusinessException(\"connection error\");\n        }\n        return routineManager.previewInvocation(connection, completeOperation(operation));\n    }\n\n    @Override\n    public SqlPreview previewMigration(RoutineOperation operation) {\n        IRoutineManager routineManager = Chat2DBContext.getRoutineManager();\n        if (routineManager == null) {\n            throw new BusinessException(\"routine.operation.onlyMysqlSupported\");\n        }\n        Connection connection = Chat2DBContext.getConnection();\n        if (connection == null) {\n            throw new BusinessException(\"connection error\");\n        }\n        return routineManager.previewMigration(connection, completeOperation(operation));\n    }","sourceCodeStart":7,"sourceCodeEnd":43,"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/DbRoutineOperationServiceImpl.java#L7-L43","documentation":"Thrown by DbRoutineOperationServiceImpl.previewInvocation when Chat2DBContext.getRoutineManager() returns null. Routine (function/procedure) management is provided by an IRoutineManager that is only registered by the MySQL plugin, so a null manager means the connected database type has no routine support. Resolves to 'Only MySQL functions and procedures are supported for now'. This is a capability gate, not a transient error.","triggerScenarios":"Invoking routine preview/invocation on a non-MySQL datasource (PostgreSQL, Oracle, etc.) whose plugin does not register an IRoutineManager; connecting with a dbType for which routine operations were never wired.","commonSituations":"Using the routine feature against a datasource that is not MySQL; pointing the app at a database type whose plugin omitted routine support.","solutions":["Use a MySQL datasource for routine operations.","Hide/disable the routine UI for non-MySQL connections (check routineManager availability first).","If you need routine support for another DB, implement and register an IRoutineManager for that plugin."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if (Chat2DBContext.getRoutineManager() == null) {\n    // routine operations unsupported for this dbType; disable the action\n}","typeGuard":"boolean routinesSupported() {\n    return Chat2DBContext.getRoutineManager() != null;\n}","tryCatchPattern":null,"preventionTips":["Offer routine UI only for MySQL.","Register an IRoutineManager in plugins that need routine support."],"tags":["capability-gate","routines","mysql","plugin"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}