getredash/redash · error · Exception

Connection error to: {} {}.

Error message

Connection error to: {} {}.

What it means

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.

Source

Thrown at redash/query_runner/clickhouse.py:146

            if not r.ok:
                raise Exception(r.text)

            # In certain situations the response body can be empty even if the query was successful, for example
            # when creating temporary tables.
            if not r.text:
                return {}

            response = r.json()
            if "exception" in response:
                raise Exception(response["exception"])

            return response
        except requests.RequestException as e:
            if e.response:
                details = "({}, Status Code: {})".format(e.__class__.__name__, e.response.status_code)
            else:
                details = "({})".format(e.__class__.__name__)
            raise Exception("Connection error to: {} {}.".format(url, details))

    @staticmethod
    def _define_column_type(column):
        c = column.lower()
        f = re.search(r"^nullable\((.*)\)$", c)
        if f is not None:
            c = f.group(1)
        if c.startswith("int") or c.startswith("uint"):
            return TYPE_INTEGER
        elif c.startswith("float"):
            return TYPE_FLOAT
        elif c == "datetime":
            return TYPE_DATETIME
        elif c == "date":
            return TYPE_DATE
        else:
            return TYPE_STRING

View on GitHub (pinned to ca79fe988d)

Solutions

  1. Verify the URL and port: ClickHouse's HTTP interface defaults to 8123
  2. curl the exact URL from the error message to reproduce outside Redash
  3. Fix scheme, proxy config, or start/allow-list the ClickHouse server
  4. Use the status code in the message: 404 → wrong URL path, 5xx → server/proxy side

Example fix

# before
{"url": "https://ch.internal:9000"}

# after
{"url": "http://ch.internal:8123"}
Defensive patterns

Strategy: try-catch

Validate before calling

import requests
r = requests.get(f"{url}/?query=SELECT%201", auth=(user, pwd), timeout=5)
r.raise_for_status()  # fail fast before adding the data source

Try / catch

try:
    rows = clickhouse_runner.run_query(q, u)
except Exception as e:
    if str(e).startswith('Connection error to:'):
        alert_network_team(parse_url_from(e)); rows = None

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of getredash/redash@ca79fe988d (2026-08-28). Data as JSON: /api/errors/15b582fa77860184. Report an issue: GitHub.