Mintplex-Labs/anything-llm · error

There is no supported database connector for

Error message

There is no supported database connector for ${identifier}

What it means

Thrown by getDBClient in the SQL agent when the connector identifier is anything other than the three hardcoded engines: 'mysql', 'postgresql', 'sql-server'. The identifier comes from the stored agent SQL connection configuration (agent_sql_connections system setting), and the switch lazy-loads MySQLConnector/PostgresSQLConnector/MSSQLConnector per match. Any other string — including undefined-adjacent values like 'sqlite', 'postgres', or 'mssql' — hits the default branch.

Solutions

  1. Set the connection's identifier/engine to exactly 'mysql', 'postgresql', or 'sql-server' in the agent SQL connections configuration.
  2. Check for aliases: rename 'postgres'->'postgresql', 'mssql'/'sqlserver'->'sql-server', lowercase any capitalized values.
  3. If you need another engine, add a connector class under server/utils/agents/aibitat/plugins/sql-agent/SQLConnectors/ and register a case in getDBClient.

Example fix

// before (stored connection config)
{ database_id: "postgres", connectionString: "..." }  // getDBClient('postgres') throws

// after
{ database_id: "postgresql", connectionString: "..." }  // matches case 'postgresql'
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_CONNECTORS = ["mysql", "postgresql", "sql-server"];
function assertSupportedConnector(identifier) {
  if (!SUPPORTED_CONNECTORS.includes(identifier)) {
    throw new Error(
      `Unsupported SQL connector '${identifier}'. Supported: ${SUPPORTED_CONNECTORS.join(", ")}`
    );
  }
}

Type guard

/** @param {unknown} id @returns {boolean} */
function isSupportedConnector(id) {
  return typeof id === "string" && ["mysql", "postgresql", "sql-server"].includes(id);
}

Try / catch

try {
  const client = getDBClient(identifier, connectionConfig);
} catch (e) {
  if (e.message.includes("no supported database connector")) {
    // fix the stored engine key in agent_sql_connections, then retry
  } else throw e;
}

Prevention

When it happens

Trigger: A saved agent_sql_connections entry uses 'postgres' or 'mssql' shorthand instead of the exact 'postgresql'/'sql-server' keys; config hand-edited or migrated with a different engine naming; user selects a database flavor the SQL agent never supported.

Common situations: AnythingLLM System Settings agent SQL connections edited manually; users assuming SQLite or MariaDB variants are supported; casing or alias drift ('PostgreSQL', 'SQLSERVER') in stored JSON.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/de51dc3bb2b6bc8f. Report an issue: GitHub.

Appendix: source

Thrown at server/utils/agents/aibitat/plugins/sql-agent/SQLConnectors/index.js:40

/**
 * @param {SQLEngine} identifier
 * @param {object} connectionConfig
 * @returns Database Connection Engine Class for SQLAgent or throws error
 */
function getDBClient(identifier = "", connectionConfig = {}) {
  switch (identifier) {
    case "mysql":
      const { MySQLConnector } = require("./MySQL");
      return new MySQLConnector(connectionConfig);
    case "postgresql":
      const { PostgresSQLConnector } = require("./Postgresql");
      return new PostgresSQLConnector(connectionConfig);
    case "sql-server":
      const { MSSQLConnector } = require("./MSSQL");
      return new MSSQLConnector(connectionConfig);
    default:
      throw new Error(
        `There is no supported database connector for ${identifier}`
      );
  }
}

/**
 * Lists all of the known database connection that can be used by the agent.
 * @returns {Promise<[SQLConnection]>}
 */
async function listSQLConnections() {
  return safeJsonParse(
    (await SystemSettings.get({ label: "agent_sql_connections" }))?.value,
    []
  );
}

/**
 * Validates a SQL connection by attempting to connect and run a simple query

View on GitHub (pinned to 3aec848f28)