{"record":{"id":"f22154613afa2c9d","repo":"JuliusBrussee/caveman","slug":"unsupported-proxy-protocol-proxy-protocol","errorCode":null,"errorMessage":"unsupported proxy protocol: ${proxy.protocol}","messagePattern":"unsupported proxy protocol: (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/cli/src/proxy-fetch.ts","lineNumber":120,"sourceCode":"      : [\"http_proxy\", \"HTTP_PROXY\", \"all_proxy\", \"ALL_PROXY\"];\n  const configured = readEnv(env, names);\n  return configured ? parseProxyUrl(configured) : null;\n}\n\nfunction proxyAuthHeader(proxy: URL): OutgoingHttpHeaders {\n  if (!proxy.username && !proxy.password) return {};\n  const credentials = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;\n  return { \"proxy-authorization\": `Basic ${Buffer.from(credentials).toString(\"base64\")}` };\n}\n\nfunction abortError(): Error {\n  return new DOMException(\"This operation was aborted\", \"AbortError\") as unknown as Error;\n}\n\nfunction proxyRequest(proxy: URL): typeof httpsRequest {\n  if (proxy.protocol === \"http:\") return httpRequest;\n  if (proxy.protocol === \"https:\") return httpsRequest;\n  throw new TypeError(`unsupported proxy protocol: ${proxy.protocol}`);\n}\n\n/**\n * Opens a CONNECT tunnel so TLS is negotiated with the target, not the proxy.\n *\n * Terminating TLS at the proxy would hand it the request and, for a signed\n * release download, the bytes we are about to trust.\n */\nfunction openTunnel(target: URL, proxy: URL, signal: AbortSignal | null): Promise<Socket> {\n  return new Promise((resolve, reject) => {\n    if (signal?.aborted) {\n      reject(abortError());\n      return;\n    }\n\n    let settled = false;\n    const finish = (error?: Error, socket?: Socket) => {\n      if (settled) {","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/cli/src/proxy-fetch.ts#L102-L138","documentation":"proxyRequest only supports HTTP and HTTPS proxy URLs; it returns the matching request factory for the proxy's scheme. If the proxy URL uses any other protocol (socks5:, ftp:, file:, etc.), it throws a TypeError. The library deliberately supports only http/https CONNECT-style proxies.","triggerScenarios":"Setting HTTPS_PROXY/HTTP_PROXY/ALL_PROXY (or a proxy config) to a URL whose protocol is not http: or https: — most commonly socks5:// or socks5h:// proxy URLs, or a proxy URL missing the scheme so it parses with an unexpected protocol.","commonSituations":"Developers pointing the CLI at a corporate SOCKS proxy; copying a proxy URL from tooling that accepts socks5; a proxy env var set without 'http://' prefix producing a parsed protocol they didn't expect.","solutions":["Change the proxy URL to use http:// or https:// (e.g. http://proxy.corp:8080) in the env var or config","If only a SOCKS proxy is available, run a local HTTP-to-SOCKS bridge (e.g. via tools like privoxy, gost, or pp) and point the env var at it","Print the proxy URL being used and verify its protocol: new URL(process.env.HTTPS_PROXY ?? '').protocol === 'http:' || 'https:'"],"exampleFix":"// before\nHTTPS_PROXY=socks5://127.0.0.1:1080 myapp stats\n// after\nHTTPS_PROXY=http://127.0.0.1:1080 myapp stats","handlingStrategy":"validation","validationCode":"function assertHttpProxyUrl(raw) {\n  const u = new URL(raw);\n  if (u.protocol !== \"http:\" && u.protocol !== \"https:\") {\n    throw new TypeError(`proxy must be http/https, got ${u.protocol}`);\n  }\n  return u;\n}","typeGuard":"const isHttpLikeProxy = (u: URL): u is URL => u.protocol === \"http:\" || u.protocol === \"https:\";","tryCatchPattern":null,"preventionTips":["Never set socks5:// in HTTP(S)_PROXY / ALL_PROXY env vars for this tool","Add a startup check that validates proxy URLs' protocols before making requests","Document the expected proxy scheme in team onboarding/config templates"],"tags":["network","proxy","configuration"],"backgroundTag":"unsupported-protocol","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}