getredash/redash · error · Exception

Couchbase connection error

Error message

Couchbase connection error

What it means

The catch-all branch of CouchbaseRunner.call_service: any HTTPError other than 401 (403, 404, 405, 500, ...) is re-raised as 'Couchbase connection error', discarding the status detail.

Source

Thrown at redash/query_runner/couchbase.py:149

    def call_service(self, query, user):
        try:
            user = self.configuration.get("user")
            password = self.configuration.get("password")
            protocol = self.configuration.get("protocol", "http")
            host = self.configuration.get("host")
            port = self.configuration.get("port", 8095)
            params = {"statement": query}

            url = "%s://%s:%s/query/service" % (protocol, host, port)

            r = requests.post(url, params=params, auth=(user, password))
            r.raise_for_status()
            return r
        except requests.exceptions.HTTPError as err:
            if err.response.status_code == 401:
                raise Exception("Wrong username/password")
            raise Exception("Couchbase connection error")

    def run_query(self, query, user):
        result = self.call_service(query, user)

        rows, columns = parse_results(result.json()["results"])
        data = {"columns": columns, "rows": rows}

        return data, None

    @classmethod
    def name(cls):
        return "Couchbase"


register(Couchbase)

View on GitHub (pinned to ca79fe988d)

Solutions

  1. Verify the URL points at the query service (default port 8093, path /query/service)
  2. Reproduce with curl -u user:pass 'http://host:8093/query/service' -d 'statement=SELECT 1' to see the real status
  3. Check RBAC roles (403) and proxy rules (405)
  4. Upgrade Redash if the Couchbase version changed endpoint behavior

Example fix

# before
{"host": "couchbase.internal"}

# after
{"host": "couchbase.internal:8093"}
Defensive patterns

Strategy: try-catch

Validate before calling

import requests
r = requests.post(f"http://{host}:8093/query/service", data={"statement": "SELECT 1"}, auth=(u, p), timeout=5)
print(r.status_code, r.text[:200])  # surface 403/404/405 before Redash does

Try / catch

try:
    result = runner.call_service(q, u)
except Exception as e:
    if 'Couchbase connection error' in str(e):
        diagnose_endpoint_with_curl(); alert_admin_with_status()

Prevention

When it happens

Trigger: POSTing a N1QL statement to the query service endpoint when it returns a non-401 HTTP error: wrong URL/path (404), insufficient RBAC role (403), method blocked by a proxy (405), or server-side failure (500).

Common situations: Missing :8093 query-service port in the URL, reverse proxy blocking POST, or Couchbase versions with different endpoint behavior.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


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