usebruno/bruno · error · Error
Invalid system http_proxy "${http_proxy}": ${error.message}
Error message
Invalid system http_proxy "${http_proxy}": ${error.message} What it means
Thrown when Bruno runs in `proxyMode === 'system'` (no PAC URL) and the configured `http_proxy` value cannot be parsed or turned into an agent for a plaintext-HTTP request. The guard wraps `new URL(http_proxy)` plus `getOrCreateHttpAgent(...)`; any exception from either is rethrown with this message. It is an environment-validation error: Bruno refuses to silently ship traffic through an unparseable proxy.
Source
Thrown at packages/bruno-electron/src/utils/proxy-util.js:191
} else {
const shouldUseSystemProxy = shouldUseProxy(requestConfig.url, no_proxy || '');
if (shouldUseSystemProxy) {
try {
if (http_proxy?.length && !isHttpsRequest) {
const parsedHttpProxy = new URL(http_proxy);
const isHttpsSystemProxy = parsedHttpProxy.protocol === 'https:';
const systemHttpProxyAgentOptions = isHttpsSystemProxy ? { keepAlive: true, ...tlsOptions } : { keepAlive: true };
if (timeline) {
timeline.push({
timestamp: new Date(),
type: 'info',
message: `Using system proxy: ${http_proxy}`
});
}
requestConfig.httpAgent = getOrCreateHttpAgent({ AgentClass: HttpProxyAgent, options: systemHttpProxyAgentOptions, proxyUri: http_proxy, timeline, disableCache, hostname });
}
} catch (error) {
throw new Error(`Invalid system http_proxy "${http_proxy}": ${error.message}`);
}
try {
if (https_proxy?.length && isHttpsRequest) {
new URL(https_proxy);
if (timeline) {
timeline.push({
timestamp: new Date(),
type: 'info',
message: `Using system proxy: ${https_proxy}`
});
}
requestConfig.httpsAgent = getOrCreateHttpsAgent({ AgentClass: PatchedHttpsProxyAgent, options: tlsOptions, proxyUri: https_proxy, timeline, disableCache, hostname });
}
} catch (error) {
throw new Error(`Invalid system https_proxy "${https_proxy}": ${error.message}`);
}
}
}View on GitHub (pinned to 9bdd81c7bd)
Solutions
- Set the full scheme on the proxy, e.g. `http_proxy=http://proxy.local:8080` (or `https://` if the proxy itself is TLS).
- Verify the value is not an unexpanded variable: print it and ensure no literal `${...}` remains.
- If no proxy is needed, unset `http_proxy` for the Bruno process or add the target host to `no_proxy`.
- Restart Bruno after editing the env var so the electron process re-reads it.
Example fix
// before export http_proxy=proxy.local:8080 // missing scheme -> new URL() throws // after export http_proxy=http://proxy.local:8080
Defensive patterns
Strategy: validation
Validate before calling
function isValidProxyUrl(value) {
if (typeof value !== 'string' || value.trim() === '') return false;
try { new URL(value.trim()); return true; } catch { return false; }
}
// before configuring system proxy
if (http_proxy && !isValidProxyUrl(http_proxy)) {
throw new Error(`Refusing to start: http_proxy is malformed: ${http_proxy}`);
} Type guard
function isProxyUrl(value: unknown): value is string {
if (typeof value !== 'string' || value.trim() === '') return false;
try { new URL(value.trim()); return true; } catch { return false; }
} Try / catch
try {
// configure agent
} catch (error) {
if (/Invalid system http_proxy/.test(error.message)) {
// surface a 'fix your proxy env' message and fall back to direct
} else throw error;
} Prevention
- Validate proxy URLs at app startup, not on the first request.
- Always include the scheme (http:// or https://) on proxy env vars.
- Log the resolved proxy value (host only) when proxyMode is 'system' to catch unexpanded ${VAR}.
When it happens
Trigger: Calling a request where `isHttpsRequest === false` while `proxyConfig.http_proxy` (from system/env) is a non-empty string, `pac_url` is absent, `shouldUseProxy(url, no_proxy)` returns true, and `http_proxy` fails `new URL()` (e.g. `proxy.local:8080`) or `getOrCreateHttpAgent` rejects it.
Common situations: Shell-exported `http_proxy` missing the `http://`/`https://` scheme; an unexpanded `${VAR}` literal left in the value; trailing whitespace or a stray port; a corporate proxy string pasted from docs with a typo; a port-only or host-only string.
Related errors
- Invalid system https_proxy "${https_proxy}": ${error.message
- Could not reach the mock server
- Workspace path is required
- Workspace path does not exist: ${workspacePath}
- Invalid workspace: workspace.yml not found
AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13).
Data as JSON: /api/errors/4698ffb2bcd37575.
Report an issue: GitHub.