Mintplex-Labs/anything-llm · error · Error

There is no supported database connector for ${identifier}

Error message

There is no supported database connector for ${identifier}

What it means

Thrown by getDBClient in the SQL agent connectors module. The factory switch only instantiates connectors for 'mysql', 'postgresql', and 'sql-server'. Any other engine identifier reaches the default branch and throws. This prevents the agent from attempting to use a driver that has no connector implementation.

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 526360e320)

Solutions

  1. Ensure the engine identifier is exactly one of: 'mysql', 'postgresql', 'sql-server' (note the hyphen, not underscore).
  2. If you need another database, implement a new connector class in SQLConnectors/ and add a case to the switch.
  3. Check the agent_sql_connections SystemSettings value for typos or incorrect engine strings.
  4. Validate the identifier before calling getDBClient: log it to confirm what is actually being passed.

Example fix

// before
switch (identifier) {
  case "mysql": /* ... */
  case "postgresql": /* ... */
  case "sql-server": /* ... */
  default:
    throw new Error(`There is no supported database connector for ${identifier}`);
}

// caller-side fix — validate before instantiating
const SUPPORTED = ["mysql", "postgresql", "sql-server"];
if (!SUPPORTED.includes(identifier)) {
  throw new Error(`Unsupported engine "${identifier}". Supported: ${SUPPORTED.join(", ")}`);
}
return getDBClient(identifier, connectionConfig);
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_ENGINES = ["mysql", "postgresql", "sql-server"];
if (!SUPPORTED_ENGINES.includes(identifier)) {
  throw new Error(
    `Unsupported SQL engine "${identifier}". Supported: ${SUPPORTED_ENGINES.join(", ")}`
  );
}
return getDBClient(identifier, connectionConfig);

Type guard

/** @param {string} id */
function isSupportedEngine(id) {
  return ["mysql", "postgresql", "sql-server"].includes(id);
}

Try / catch

try {
  const client = getDBClient(identifier, connectionConfig);
  await client.connect();
} catch (e) {
  if (e.message.includes("no supported database connector")) {
    // Inform the user of valid options rather than crashing
    return { error: `Database "${identifier}" is not supported. Use mysql, postgresql, or sql-server.` };
  }
  throw e;
}

Prevention

When it happens

Trigger: Configuring an agent_sql_connections entry with an engine identifier outside the supported set — e.g. 'sqlite', 'oracle', 'snowflake', 'mongo', or a typo like 'postgres' (should be 'postgresql'). Also triggered by passing an empty or undefined identifier to getDBClient.

Common situations: User sets up a SQL connection in the UI and selects or types an unsupported engine; the connection config JSON was hand-edited with a wrong engine value; a typo in the identifier string; trying to use a database the SQL agent was never built to support.

Related errors


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