{"record":{"id":"f0228581aaa26521","repo":"usebruno/bruno","slug":"invalid-system-https-proxy-https-proxy-err","errorCode":null,"errorMessage":"Invalid system https_proxy \"${https_proxy}\": ${error.message}","messagePattern":"Invalid system https_proxy \"(.+?)\": (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/utils/proxy-util.js","lineNumber":206,"sourceCode":"            requestConfig.httpAgent = getOrCreateHttpAgent({ AgentClass: HttpProxyAgent, options: systemHttpProxyAgentOptions, proxyUri: http_proxy, timeline, disableCache, hostname });\n          }\n        } catch (error) {\n          throw new Error(`Invalid system http_proxy \"${http_proxy}\": ${error.message}`);\n        }\n        try {\n          if (https_proxy?.length && isHttpsRequest) {\n            new URL(https_proxy);\n            if (timeline) {\n              timeline.push({\n                timestamp: new Date(),\n                type: 'info',\n                message: `Using system proxy: ${https_proxy}`\n              });\n            }\n            requestConfig.httpsAgent = getOrCreateHttpsAgent({ AgentClass: PatchedHttpsProxyAgent, options: tlsOptions, proxyUri: https_proxy, timeline, disableCache, hostname });\n          }\n        } catch (error) {\n          throw new Error(`Invalid system https_proxy \"${https_proxy}\": ${error.message}`);\n        }\n      }\n    }\n  } else if (proxyMode === 'pac') {\n    const pacSource = get(proxyConfig, 'pac.source');\n    if (pacSource) {\n      if (timeline) timeline.push({ timestamp: new Date(), type: 'info', message: `Resolving PAC: ${pacSource}` });\n      try {\n        const { directives, httpAgent, httpsAgent } = await resolveAgentsFromPac({ pacSource, requestUrl: requestConfig.url, requestProtocol: isHttpsRequest ? 'https' : 'http', tlsOptions, httpsAgentRequestFields, timeline, disableCache, hostname });\n        if (httpAgent) requestConfig.httpAgent = httpAgent;\n        if (httpsAgent) requestConfig.httpsAgent = httpsAgent;\n        if (directives) {\n          if (timeline) timeline.push({ timestamp: new Date(), type: 'info', message: `PAC directives: ${directives.join('; ')}` });\n        } else {\n          if (timeline) timeline.push({ timestamp: new Date(), type: 'info', message: 'PAC resolved: DIRECT (no proxy)' });\n        }\n      } catch (err) {\n        if (timeline) timeline.push({ timestamp: new Date(), type: 'error', message: `PAC resolution failed: ${err.message}` });","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/utils/proxy-util.js#L188-L224","documentation":"Sibling of the http_proxy error: thrown when `proxyMode === 'system'` (no PAC URL) and `https_proxy` is non-empty, the request is HTTPS (`isHttpsRequest === true`), `shouldUseProxy` is true, and `new URL(https_proxy)` throws. Bruno will not create a `PatchedHttpsProxyAgent` from a value it cannot parse.","triggerScenarios":"HTTPS request issued with a non-empty `proxyConfig.https_proxy`, no `pac_url`, `shouldUseProxy(url, no_proxy) === true`, and `new URL(https_proxy)` raising (invalid scheme, bad characters, empty host).","commonSituations":"Copied `https_proxy=proxy:3128` without scheme; value contains spaces or quotes from a `.env` file; proxy auto-config left a malformed token; an SSL-intercepting corporate proxy URL typed without `http://` (the proxy endpoint, not the target, usually needs `http://`).","solutions":["Add the scheme to the proxy URL: `https_proxy=http://proxy.local:3128` (the scheme describes the proxy endpoint, not the proxied traffic).","Strip whitespace/quotes and confirm no unexpanded `${...}`.","Add the target host to `no_proxy` if it should bypass the proxy.","Restart Bruno so the electron main process reloads the env."],"exampleFix":"// before\nexport https_proxy=proxy:3128   // new URL() throws\n\n// after\nexport https_proxy=http://proxy.local:3128","handlingStrategy":"validation","validationCode":"function isValidProxyUrl(value) {\n  if (typeof value !== 'string' || value.trim() === '') return false;\n  try { new URL(value.trim()); return true; } catch { return false; }\n}\nif (https_proxy && !isValidProxyUrl(https_proxy)) {\n  throw new Error(`Refusing to start: https_proxy is malformed: ${https_proxy}`);\n}","typeGuard":"function isHttpsProxyUrl(value: unknown): value is string {\n  if (typeof value !== 'string' || value.trim() === '') return false;\n  try { new URL(value.trim()); return true; } catch { return false; }\n}","tryCatchPattern":"try {\n  // build httpsAgent\n} catch (error) {\n  if (/Invalid system https_proxy/.test(error.message)) {\n    // tell the user to fix https_proxy, optionally fall back to direct\n  } else throw error;\n}","preventionTips":["Remember the proxy URL scheme describes the proxy endpoint, not the target.","Strip quotes/whitespace from .env-supplied proxy values.","Add target hosts to no_proxy when they should bypass."],"tags":["network","proxy","config","electron","https"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}