{"record":{"id":"1fa636344439de63","repo":"headroomlabs-ai/headroom","slug":"failed-to-connect-to-headroom-at-this-baseurl","errorCode":null,"errorMessage":"Failed to connect to Headroom at ${this.baseUrl}: ${error}","messagePattern":"Failed to connect to Headroom at (.+?): (.+?)","errorType":"exception","errorClass":"HeadroomConnectionError","httpStatus":null,"severity":"error","filePath":"sdk/typescript/src/client.ts","lineNumber":531,"sourceCode":"      // Don't override provider auth headers\n      if (!headers[\"Authorization\"] && !headers[\"x-api-key\"]) {\n        headers[\"Authorization\"] = `Bearer ${this.apiKey}`;\n      }\n    }\n    if (this.stack && !headers[\"X-Headroom-Stack\"]) {\n      headers[\"X-Headroom-Stack\"] = this.stack;\n    }\n\n    let response: Response;\n    try {\n      response = await fetch(url, {\n        method: options.method,\n        headers,\n        body: options.body ? JSON.stringify(options.body) : undefined,\n        signal: AbortSignal.timeout(this.timeout),\n      });\n    } catch (error) {\n      throw new HeadroomConnectionError(\n        `Failed to connect to Headroom at ${this.baseUrl}: ${error}`,\n      );\n    }\n\n    if (!response.ok) {\n      let errorBody: ProxyErrorResponse | undefined;\n      try {\n        errorBody = (await response.json()) as ProxyErrorResponse;\n      } catch {\n        // ignore\n      }\n      throw mapProxyError(\n        response.status,\n        errorBody?.error?.type ?? \"unknown\",\n        errorBody?.error?.message ?? `HTTP ${response.status}`,\n      );\n    }\n","sourceCodeStart":513,"sourceCodeEnd":549,"githubUrl":"https://github.com/headroomlabs-ai/headroom/blob/322425c43bffde1ed0b64fecf3cf5951565dd82b/sdk/typescript/src/client.ts#L513-L549","documentation":"Error \"Failed to connect to Headroom at ${this.baseUrl}: ${error}\" thrown in headroomlabs-ai/headroom.","triggerScenarios":"Raised when the TypeScript client cannot establish a connection to the Headroom server at the configured base URL.","commonSituations":"See trigger scenarios.","solutions":["Start the Headroom proxy/server and confirm it listens on ${this.baseUrl}","Check for port conflicts or firewall rules blocking the connection","Verify the baseUrl passed to the client is correct (scheme, host, port)","Inspect ${error} for connection refused vs timeout vs DNS failure"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"322425c43bffde1ed0b64fecf3cf5951565dd82b","analyzedAt":"2026-08-15T01:03:05.481Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}