{"record":{"id":"15b582fa77860184","repo":"getredash/redash","slug":"connection-error-to","errorCode":null,"errorMessage":"Connection error to: {} {}.","messagePattern":"Connection error to: (.+?) (.+?)\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"redash/query_runner/clickhouse.py","lineNumber":146,"sourceCode":"            if not r.ok:\n                raise Exception(r.text)\n\n            # In certain situations the response body can be empty even if the query was successful, for example\n            # when creating temporary tables.\n            if not r.text:\n                return {}\n\n            response = r.json()\n            if \"exception\" in response:\n                raise Exception(response[\"exception\"])\n\n            return response\n        except requests.RequestException as e:\n            if e.response:\n                details = \"({}, Status Code: {})\".format(e.__class__.__name__, e.response.status_code)\n            else:\n                details = \"({})\".format(e.__class__.__name__)\n            raise Exception(\"Connection error to: {} {}.\".format(url, details))\n\n    @staticmethod\n    def _define_column_type(column):\n        c = column.lower()\n        f = re.search(r\"^nullable\\((.*)\\)$\", c)\n        if f is not None:\n            c = f.group(1)\n        if c.startswith(\"int\") or c.startswith(\"uint\"):\n            return TYPE_INTEGER\n        elif c.startswith(\"float\"):\n            return TYPE_FLOAT\n        elif c == \"datetime\":\n            return TYPE_DATETIME\n        elif c == \"date\":\n            return TYPE_DATE\n        else:\n            return TYPE_STRING\n","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/getredash/redash/blob/ca79fe988d81cdac9675b412f3dfcab107bc1fbc/redash/query_runner/clickhouse.py#L128-L164","documentation":"ClickHouse runner's _send_query wraps requests.RequestException from the HTTP call and re-raises with the target URL, the exception class, and (when present) the HTTP status code. The HTTP layer failed before a valid ClickHouse response was parsed.","triggerScenarios":"Any query where the request to http(s)://host:port/?query=... fails: DNS failure, connection refused, TLS errors, or a non-2xx status (404 wrong path, 502 from a proxy).","commonSituations":"Wrong host/port (using native port 9000 instead of HTTP port 8123), ClickHouse behind a misconfigured reverse proxy, server not listening, or http/https scheme mismatch.","solutions":["Verify the URL and port: ClickHouse's HTTP interface defaults to 8123","curl the exact URL from the error message to reproduce outside Redash","Fix scheme, proxy config, or start/allow-list the ClickHouse server","Use the status code in the message: 404 → wrong URL path, 5xx → server/proxy side"],"exampleFix":"# before\n{\"url\": \"https://ch.internal:9000\"}\n\n# after\n{\"url\": \"http://ch.internal:8123\"}","handlingStrategy":"try-catch","validationCode":"import requests\nr = requests.get(f\"{url}/?query=SELECT%201\", auth=(user, pwd), timeout=5)\nr.raise_for_status()  # fail fast before adding the data source","typeGuard":null,"tryCatchPattern":"try:\n    rows = clickhouse_runner.run_query(q, u)\nexcept Exception as e:\n    if str(e).startswith('Connection error to:'):\n        alert_network_team(parse_url_from(e)); rows = None","preventionTips":["Health-check the ClickHouse HTTP port (8123) from the Redash host before configuring","Use http unless TLS is confirmed","Alert on recurring connection errors to catch infrastructure drift"],"tags":["redash","clickhouse","network","http"],"backgroundTag":"connection-refused","analyzedSha":"ca79fe988d81cdac9675b412f3dfcab107bc1fbc","analyzedAt":"2026-08-28T18:32:34.637Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}