{"record":{"id":"de51dc3bb2b6bc8f","repo":"Mintplex-Labs/anything-llm","slug":"there-is-no-supported-database-connector-for-ide","errorCode":null,"errorMessage":"There is no supported database connector for ${identifier}","messagePattern":"There is no supported database connector for (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/agents/aibitat/plugins/sql-agent/SQLConnectors/index.js","lineNumber":40,"sourceCode":"\n/**\n * @param {SQLEngine} identifier\n * @param {object} connectionConfig\n * @returns Database Connection Engine Class for SQLAgent or throws error\n */\nfunction getDBClient(identifier = \"\", connectionConfig = {}) {\n  switch (identifier) {\n    case \"mysql\":\n      const { MySQLConnector } = require(\"./MySQL\");\n      return new MySQLConnector(connectionConfig);\n    case \"postgresql\":\n      const { PostgresSQLConnector } = require(\"./Postgresql\");\n      return new PostgresSQLConnector(connectionConfig);\n    case \"sql-server\":\n      const { MSSQLConnector } = require(\"./MSSQL\");\n      return new MSSQLConnector(connectionConfig);\n    default:\n      throw new Error(\n        `There is no supported database connector for ${identifier}`\n      );\n  }\n}\n\n/**\n * Lists all of the known database connection that can be used by the agent.\n * @returns {Promise<[SQLConnection]>}\n */\nasync function listSQLConnections() {\n  return safeJsonParse(\n    (await SystemSettings.get({ label: \"agent_sql_connections\" }))?.value,\n    []\n  );\n}\n\n/**\n * Validates a SQL connection by attempting to connect and run a simple query","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/agents/aibitat/plugins/sql-agent/SQLConnectors/index.js#L22-L58","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the engine identifier is exactly one of: 'mysql', 'postgresql', 'sql-server' (note the hyphen, not underscore).","If you need another database, implement a new connector class in SQLConnectors/ and add a case to the switch.","Check the agent_sql_connections SystemSettings value for typos or incorrect engine strings.","Validate the identifier before calling getDBClient: log it to confirm what is actually being passed."],"exampleFix":"// before\nswitch (identifier) {\n  case \"mysql\": /* ... */\n  case \"postgresql\": /* ... */\n  case \"sql-server\": /* ... */\n  default:\n    throw new Error(`There is no supported database connector for ${identifier}`);\n}\n\n// caller-side fix — validate before instantiating\nconst SUPPORTED = [\"mysql\", \"postgresql\", \"sql-server\"];\nif (!SUPPORTED.includes(identifier)) {\n  throw new Error(`Unsupported engine \"${identifier}\". Supported: ${SUPPORTED.join(\", \")}`);\n}\nreturn getDBClient(identifier, connectionConfig);","handlingStrategy":"validation","validationCode":"const SUPPORTED_ENGINES = [\"mysql\", \"postgresql\", \"sql-server\"];\nif (!SUPPORTED_ENGINES.includes(identifier)) {\n  throw new Error(\n    `Unsupported SQL engine \"${identifier}\". Supported: ${SUPPORTED_ENGINES.join(\", \")}`\n  );\n}\nreturn getDBClient(identifier, connectionConfig);","typeGuard":"/** @param {string} id */\nfunction isSupportedEngine(id) {\n  return [\"mysql\", \"postgresql\", \"sql-server\"].includes(id);\n}","tryCatchPattern":"try {\n  const client = getDBClient(identifier, connectionConfig);\n  await client.connect();\n} catch (e) {\n  if (e.message.includes(\"no supported database connector\")) {\n    // Inform the user of valid options rather than crashing\n    return { error: `Database \"${identifier}\" is not supported. Use mysql, postgresql, or sql-server.` };\n  }\n  throw e;\n}","preventionTips":["Validate the engine identifier against the supported list before calling getDBClient.","Use exact string matching — 'postgresql' not 'postgres', 'sql-server' not 'sqlserver'.","Validate the agent_sql_connections SystemSettings JSON at write time, not just read time.","Log the identifier value when debugging to catch typos."],"tags":["sql-agent","database","validation","factory-pattern","configuration"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}