OtterMind/Chat2DB · error · BusinessException

routine.operation.onlyMysqlSupported

routine.operation.onlyMysqlSupported

Error message

routine.operation.onlyMysqlSupported

What it means

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.

Source

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

import ai.chat2db.community.tools.exception.BusinessException;
import ai.chat2db.spi.IRoutineManager;
import ai.chat2db.spi.model.datasource.ConnectInfo;
import ai.chat2db.spi.sql.Chat2DBContext;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.sql.Connection;

@Service
public class DbRoutineOperationServiceImpl implements IDbRoutineOperationService {

    @Override
    public SqlPreview previewInvocation(RoutineOperation operation) {
        IRoutineManager routineManager = Chat2DBContext.getRoutineManager();
        if (routineManager == null) {
            throw new BusinessException("routine.operation.onlyMysqlSupported");
        }
        Connection connection = Chat2DBContext.getConnection();
        if (connection == null) {
            throw new BusinessException("connection error");
        }
        return routineManager.previewInvocation(connection, completeOperation(operation));
    }

    @Override
    public SqlPreview previewMigration(RoutineOperation operation) {
        IRoutineManager routineManager = Chat2DBContext.getRoutineManager();
        if (routineManager == null) {
            throw new BusinessException("routine.operation.onlyMysqlSupported");
        }
        Connection connection = Chat2DBContext.getConnection();
        if (connection == null) {
            throw new BusinessException("connection error");
        }
        return routineManager.previewMigration(connection, completeOperation(operation));
    }

View on GitHub (pinned to 5ee1e990e7)

Solutions

  1. Use a MySQL datasource for routine operations.
  2. Hide/disable the routine UI for non-MySQL connections (check routineManager availability first).
  3. If you need routine support for another DB, implement and register an IRoutineManager for that plugin.
Defensive patterns

Strategy: type-guard

Validate before calling

if (Chat2DBContext.getRoutineManager() == null) {
    // routine operations unsupported for this dbType; disable the action
}

Type guard

boolean routinesSupported() {
    return Chat2DBContext.getRoutineManager() != null;
}

Prevention

When it happens

Trigger: 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.

Common situations: Using the routine feature against a datasource that is not MySQL; pointing the app at a database type whose plugin omitted routine support.

Related errors


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