different-ai/openwork · error · Error

No proxy configured: set the ${key} environment variable to

Error message

No proxy configured: set the ${key} environment variable to a proxy URL.

What it means

resolveBrowserProxyInput supports 'env:NAME' proxy references, mapping to OPENWORK_BROWSER_PROXY_<NAME>. If that environment variable is unset or empty, the throw fires — the proxy indirection cannot resolve to an actual proxy URL.

Source

Thrown at apps/desktop/electron/browser-panel.mjs:422

          runDetachedTask("open browser tab externally", () => shell.openExternal(request.url));
        }
        break;
      case "close-tab":
        if (tab) closeBrowserTab(tab.tabId);
        break;
      case "close-all-tabs":
        closeAllBrowserTabs();
        break;
    }
  }

  function resolveBrowserProxyInput(input) {
    const raw = String(input ?? "").trim();
    const envMatch = raw.match(/^env:([A-Za-z0-9_]+)$/i);
    if (!envMatch) return raw;
    const key = `OPENWORK_BROWSER_PROXY_${envMatch[1].toUpperCase()}`;
    const value = String(process.env[key] ?? "").trim();
    if (!value) throw new Error(`No proxy configured: set the ${key} environment variable to a proxy URL.`);
    return value;
  }

  function parseBrowserProxyInput(input) {
    const raw = resolveBrowserProxyInput(input);
    if (!raw) return null;
    const withScheme = /^[a-z][a-z0-9+.-]*:\/\//i.test(raw) ? raw : `http://${raw}`;
    let url;
    try {
      url = new URL(withScheme);
    } catch {
      throw new Error(`Invalid proxy URL: ${raw}`);
    }
    if (!url.hostname || !url.port) {
      throw new Error("Proxy must include host and port, e.g. http://user:pass@host:8080 or socks5://host:1080.");
    }
    const scheme = url.protocol.replace(/:$/, "").toLowerCase();
    return {

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Set OPENWORK_BROWSER_PROXY_<NAME> (e.g. export OPENWORK_BROWSER_PROXY_PRIMARY='http://user:pass@host:8080') before launching the app
  2. Replace the 'env:...' value in the proxy config with the literal proxy URL
  3. Verify the variable is visible to the Electron main process (not just your interactive shell)
  4. Check for an empty-string value — whitespace-only also triggers this

Example fix

// before
proxy: 'env:corp'
// after (with env var set)
export OPENWORK_BROWSER_PROXY_CORP='socks5://gw.internal:1080'
proxy: 'env:corp'
Defensive patterns

Strategy: validation

Validate before calling

const key = 'OPENWORK_BROWSER_PROXY_PRIMARY';
if (config.proxy.startsWith('env:') && !String(process.env[`OPENWORK_BROWSER_PROXY_${config.proxy.slice(4).toUpperCase()}`] ?? '').trim()) {
  throw new Error(`${key} must be set before launching the app`);
}

Type guard

function hasResolvedEnvProxy(raw, env = process.env) {
  const m = /^env:([A-Za-z0-9_]+)$/i.exec(String(raw ?? '').trim());
  return !m || Boolean(String(env[`OPENWORK_BROWSER_PROXY_${m[1].toUpperCase()}`] ?? '').trim());
}

Try / catch

try {
  await createBrowserPanel({ proxy: 'env:corp' });
} catch (e) {
  if (e.message.startsWith('No proxy configured: set the ')) {
    // prompt user to set the env var or supply a literal proxy URL
  } else throw e;
}

Prevention

When it happens

Trigger: Configuring the browser proxy as e.g. 'env:primary' (or 'env:PRIMARY') while OPENWORK_BROWSER_PROXY_PRIMARY is not set in the Electron main process environment.

Common situations: Proxy defined in a config file committed for teammates whose local env lacks the variable; launching the app from a shell/Finder that does not inherit the .env; uppercase mismatch is impossible (key is uppercased), so usually the var is simply missing or empty; systemd/GUI launches without shell env.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/5390ad5f67f09637. Report an issue: GitHub.