{"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":"exception","errorClass":null,"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/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/agents/aibitat/plugins/sql-agent/SQLConnectors/index.js#L22-L58","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set the connection's identifier/engine to exactly 'mysql', 'postgresql', or 'sql-server' in the agent SQL connections configuration.","Check for aliases: rename 'postgres'->'postgresql', 'mssql'/'sqlserver'->'sql-server', lowercase any capitalized values.","If you need another engine, add a connector class under server/utils/agents/aibitat/plugins/sql-agent/SQLConnectors/ and register a case in getDBClient."],"exampleFix":"// before (stored connection config)\n{ database_id: \"postgres\", connectionString: \"...\" }  // getDBClient('postgres') throws\n\n// after\n{ database_id: \"postgresql\", connectionString: \"...\" }  // matches case 'postgresql'","handlingStrategy":"validation","validationCode":"const SUPPORTED_CONNECTORS = [\"mysql\", \"postgresql\", \"sql-server\"];\nfunction assertSupportedConnector(identifier) {\n  if (!SUPPORTED_CONNECTORS.includes(identifier)) {\n    throw new Error(\n      `Unsupported SQL connector '${identifier}'. Supported: ${SUPPORTED_CONNECTORS.join(\", \")}`\n    );\n  }\n}","typeGuard":"/** @param {unknown} id @returns {boolean} */\nfunction isSupportedConnector(id) {\n  return typeof id === \"string\" && [\"mysql\", \"postgresql\", \"sql-server\"].includes(id);\n}","tryCatchPattern":"try {\n  const client = getDBClient(identifier, connectionConfig);\n} catch (e) {\n  if (e.message.includes(\"no supported database connector\")) {\n    // fix the stored engine key in agent_sql_connections, then retry\n  } else throw e;\n}","preventionTips":["Constrain the engine field in agent SQL connection forms to the three exact strings.","Normalize aliases on save: postgres->postgresql, mssql/sqlserver->sql-server, lowercase everything.","Validate stored agent_sql_connections entries against SUPPORTED_CONNECTORS at startup."],"tags":["sql-agent","database-connector","config","agent-tools"],"backgroundTag":"unsupported-connector","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}