{"record":{"id":"1c4a9d049b0bc6da","repo":"garrytan/gstack","slug":"unsupported-proxy-scheme-scheme","errorCode":null,"errorMessage":"unsupported proxy scheme '${scheme}'","messagePattern":"unsupported proxy scheme '(.+?)'","errorType":"validation","errorClass":"ProxyConfigError","httpStatus":null,"severity":"error","filePath":"browse/src/proxy-config.ts","lineNumber":57,"sourceCode":" */\nexport function parseProxyConfig(opts: {\n  proxyUrl: string;\n  envUser?: string;\n  envPass?: string;\n}): ParsedProxyConfig {\n  let url: URL;\n  try {\n    url = new URL(opts.proxyUrl);\n  } catch {\n    throw new ProxyConfigError(\n      'expected scheme://[user:pass@]host:port',\n      `invalid proxy URL — could not parse`,\n    );\n  }\n\n  const scheme = url.protocol.replace(':', '');\n  if (scheme !== 'socks5' && scheme !== 'http' && scheme !== 'https') {\n    throw new ProxyConfigError(\n      'use socks5://, http://, or https://',\n      `unsupported proxy scheme '${scheme}'`,\n    );\n  }\n\n  if (!url.hostname) {\n    throw new ProxyConfigError(\n      'expected scheme://[user:pass@]host:port',\n      `invalid proxy URL — missing host`,\n    );\n  }\n\n  const port = url.port\n    ? parseInt(url.port, 10)\n    : (scheme === 'http' ? 80 : scheme === 'https' ? 443 : 1080);\n  if (!Number.isInteger(port) || port <= 0 || port > 65535) {\n    throw new ProxyConfigError(\n      'expected scheme://[user:pass@]host:port',","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/browse/src/proxy-config.ts#L39-L75","documentation":"Thrown by parseProxyConfig when the URL parses successfully but its protocol is not one of socks5, http, or https. Any other scheme (ftp, socks4, smtp, file) is refused because the downstream SOCKS bridge / Chromium launcher only supports those three.","triggerScenarios":"Passing a proxy URL whose scheme is unsupported: socks4://, ftp://, ssh://, or a typo like 'socks://'.","commonSituations":"SOCKS4 proxy mistakenly written as socks4:// when only socks5 is supported; legacy proxy URL with an old scheme; typo in the scheme string; copy-pasted a URL from a tool that uses a different protocol name.","solutions":["Switch socks4:// to socks5:// (and confirm the proxy actually speaks SOCKS5)","Use http:// or https:// for HTTP/HTTPS proxies","Correct typos: 'socks://' is not valid — pick socks5://, http://, or https://","Confirm the proxy server's actual protocol with its operator"],"exampleFix":"# before\nBROWSE_PROXY_URL=socks4://proxy.local:1080  # throws\n\n# after\nBROWSE_PROXY_URL=socks5://proxy.local:1080","handlingStrategy":"validation","validationCode":"const ALLOWED = new Set(['socks5:', 'http:', 'https:']);\n\nfunction hasSupportedScheme(s: string): boolean {\n  try { return ALLOWED.has(new URL(s).protocol); }\n  catch { return false; }\n}\n\nif (!hasSupportedScheme(proxyUrl)) {\n  throw new Error('Proxy scheme must be socks5, http, or https');\n}","typeGuard":"function isSupportedProxyScheme(s: string): boolean {\n  try { return ALLOWED.has(new URL(s).protocol); } catch { return false; }\n}","tryCatchPattern":"try {\n  parseProxyConfig(opts);\n} catch (e) {\n  if (e instanceof ProxyConfigError && /unsupported proxy scheme/.test(e.message)) {\n    console.error(`Scheme not supported. ${e.hint}`);\n  }\n  throw e;\n}","preventionTips":["Confirm the proxy server actually speaks SOCKS5 (not SOCKS4) before using socks5://","Standardize on one scheme across your config files and CI","Validate the scheme in your config loader before passing to parseProxyConfig","Watch for typos: 'socks://' is not valid"],"tags":["proxy","config","unsupported-scheme","network","proxy-config-error"],"backgroundTag":null,"analyzedSha":"94993f74012782fd94416dd44b8314f6363a13a4","analyzedAt":"2026-08-12T04:06:23.140Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}