{"record":{"id":"2880982ec7c10f6c","repo":"cube-js/cube","slug":"error-tostring","errorCode":null,"errorMessage":"error.toString()","messagePattern":"error\\.toString\\(\\)","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"packages/cubejs-server-core/src/core/DevServer.ts","lineNumber":547,"sourceCode":"\n          // Restore original env values\n          for (const [envName, envValue] of Object.entries(backup)) {\n            if (envValue === undefined) {\n              delete process.env[envName];\n            } else {\n              process.env[envName] = envValue;\n            }\n          }\n\n          await driver.testConnection();\n\n          this.cubejsServer.event('test_database_connection_success');\n\n          return res.json('ok');\n        } catch (error) {\n          this.cubejsServer.event('test_database_connection_error');\n\n          return res.status(400).json({\n            error: error.toString()\n          });\n        } finally {\n          if (driver && (<any>driver).release) {\n            await (<any>driver).release();\n          }\n        }\n      }\n    ));\n\n    app.post('/playground/env', catchErrors(async (req, res) => {\n      let { variables = {} } = req.body || {};\n\n      if (!variables.CUBEJS_API_SECRET) {\n        variables.CUBEJS_API_SECRET = options.apiSecret;\n      }\n\n      let envs: Record<string, string> = {};","sourceCodeStart":529,"sourceCodeEnd":565,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-server-core/src/core/DevServer.ts#L529-L565","documentation":"Not a thrown error: the POST db test-connection endpoint in DevServer catches any error thrown by driver.testConnection() (after restoring environment overrides) and returns HTTP 400 with error.toString(), marking the event 'test_database_connection_error'. It means the configured database credentials/connection failed the driver's connectivity check.","triggerScenarios":"Thrown at packages/cubejs-server-core/src/core/DevServer.ts:547 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the returned error message for the underlying cause (auth failure, unreachable host, bad port, TLS issues).","Verify the database credentials and host configuration, including any env var overrides applied by the playground.","Re-test after correcting the config; a success returns 'ok' with event 'test_database_connection_success'."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}