{"record":{"id":"b6f601767345ccb2","repo":"getredash/redash","slug":"got-invalid-response-from-graphite-http-status-co","errorCode":null,"errorMessage":"Got invalid response from Graphite (http status code: {0}).","messagePattern":"Got invalid response from Graphite \\(http status code: (.+?)\\)\\.","errorType":"http","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"redash/query_runner/graphite.py","lineNumber":76,"sourceCode":"        super(Graphite, self).__init__(configuration)\n        self.syntax = \"custom\"\n\n        if \"username\" in self.configuration and self.configuration[\"username\"]:\n            self.auth = (self.configuration[\"username\"], self.configuration[\"password\"])\n        else:\n            self.auth = None\n\n        self.verify = self.configuration.get(\"verify\", True)\n        self.base_url = \"%s/render?format=json&\" % self.configuration[\"url\"]\n\n    def test_connection(self):\n        r = requests.get(\n            \"{}/render\".format(self.configuration[\"url\"]),\n            auth=self.auth,\n            verify=self.verify,\n        )\n        if r.status_code != 200:\n            raise Exception(\"Got invalid response from Graphite (http status code: {0}).\".format(r.status_code))\n\n    def run_query(self, query, user):\n        url = \"%s%s\" % (self.base_url, \"&\".join(query.split(\"\\n\")))\n        error = None\n        data = None\n\n        try:\n            response = requests.get(url, auth=self.auth, verify=self.verify)\n\n            if response.status_code == 200:\n                data = _transform_result(response)\n            else:\n                error = \"Failed getting results (%d)\" % response.status_code\n        except Exception as ex:\n            data = None\n            error = str(ex)\n\n        return data, error","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/getredash/redash/blob/ca79fe988d81cdac9675b412f3dfcab107bc1fbc/redash/query_runner/graphite.py#L58-L94","documentation":"test_connection for Graphite simply GETs {url}/render with the configured credentials and expects HTTP 200; any other status code (401 unauthorized, 404 wrong path, 502) raises this exception with the returned code embedded.","triggerScenarios":"Clicking 'Test Connection' on a Graphite data source when the URL is wrong (points to non-Graphite server returning 404), credentials are invalid (401/403), or Graphite's webapp is erroring (500/502).","commonSituations":"Base URL missing /render capability (pointing at Grafana instead of Graphite-web), trailing-slash/proxy issues, basic-auth user/password typos, self-signed cert with verify on.","solutions":["curl -u user:pass <url>/render from the Redash host and inspect the status code — 404 means wrong URL, 401 means bad credentials","Fix the URL to point at Graphite-web (not carbon/Grafana) and correct username/password","If behind a proxy, ensure /render is forwarded and returns 200"],"exampleFix":"// before\nurl = \"https://metrics.example.com\"\n// after\nurl = \"https://metrics.example.com/render\"  # verify: curl -u u:p https://metrics.example.com/render -> 200","handlingStrategy":"validation","validationCode":"import requests\n\ndef graphite_render_ok(url, auth=None) -> bool:\n    try:\n        return requests.get(f\"{url}/render\", auth=auth, timeout=10).status_code == 200\n    except requests.RequestException:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    runner.test_connection()\nexcept Exception as e:\n    if \"invalid response from Graphite\" in str(e):\n        diagnose_status_code_in_message()  # 401 creds, 404 url, 5xx server","preventionTips":["Point the URL at Graphite-web, verify /render returns 200 with curl","Keep credentials and TLS settings correct","Alert on non-200s from /render as a health check"],"tags":["graphite","http-status","authentication","connection-test"],"backgroundTag":"http-unauthorized","analyzedSha":"ca79fe988d81cdac9675b412f3dfcab107bc1fbc","analyzedAt":"2026-08-28T18:32:34.637Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}