{"record":{"id":"58894299b11d06e6","repo":"Budibase/budibase","slug":"messages-join-n","errorCode":null,"errorMessage":"${messages.join(\"\\n\")}","messagePattern":"\\$\\{messages\\.join\\(\"\\\\n\"\\)\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/server/src/integrations/microsoftSqlServer.ts","lineNumber":353,"sourceCode":"        }\n        case null:\n        case undefined:\n          break\n        default:\n          utils.unreachable(this.config)\n      }\n\n      const pool = new sqlServer.ConnectionPool(clientCfg)\n\n      this.client = await pool.connect()\n    } catch (err: any) {\n      if (err?.originalError?.errors?.length) {\n        const messages = []\n        if (err.message) {\n          messages.push(err.message)\n        }\n        messages.push(...err.originalError.errors.map((e: any) => e.message))\n        throw new Error(messages.join(\"\\n\"))\n      }\n\n      throw err\n    }\n  }\n\n  async internalQuery(\n    query: SqlQuery,\n    operation: string | undefined = undefined\n  ) {\n    const client = this.client!\n    const request = client.request()\n    this.index = 0\n    try {\n      if (Array.isArray(query.bindings)) {\n        let count = 0\n        for (let binding of query.bindings) {\n          request.input(`p${count++}`, binding)","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/integrations/microsoftSqlServer.ts#L335-L371","documentation":"microsoftSqlServer's connect() wraps mssql (tedious) connection failures: when the thrown error carries originalError.errors (tedious aggregates multiple errors), the handler collects the top-level err.message plus each nested error's message and throws a single Error with them joined by newlines. This surfaces all validation/auth/network problems reported during the connection attempt.","triggerScenarios":"mssql.connect() fails with an aggregate error: bad credentials (login failed), unreachable host/port, TLS negotiation failure, invalid database name, or certificate trust errors — anything where err.originalError.errors is a non-empty array.","commonSituations":"SQL Server not accepting remote TCP connections; wrong username/password or Windows-only auth attempted from Linux; self-signed certificates without encrypt=false or trustServerCertificate; firewall blocking port 1433; wrong instance name for a named instance.","solutions":["Read the joined messages — they contain the actual login/network error from SQL Server — and fix the underlying cause","Verify host, port, instance, user, password and database in the datasource config","Set encrypt/trustServerCertificate options appropriately for your TLS setup","Confirm network reachability (firewall, port 1433, named-instance UDP 1434) from the Budibase host"],"exampleFix":"// before: connection fails with certificate error\nconst config = { server, user, password, database } // encrypt defaults to true\n// after\nconst config = { server, user, password, database, options: { encrypt: true, trustServerCertificate: true } }","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["sql-server","mssql","connection","aggregate-error"],"backgroundTag":"sql-connection-failed","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}