{"record":{"id":"5390ad5f67f09637","repo":"different-ai/openwork","slug":"no-proxy-configured-set-the-key-environment-va","errorCode":null,"errorMessage":"No proxy configured: set the ${key} environment variable to a proxy URL.","messagePattern":"No proxy configured: set the (.+?) environment variable to a proxy URL\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/desktop/electron/browser-panel.mjs","lineNumber":422,"sourceCode":"          runDetachedTask(\"open browser tab externally\", () => shell.openExternal(request.url));\n        }\n        break;\n      case \"close-tab\":\n        if (tab) closeBrowserTab(tab.tabId);\n        break;\n      case \"close-all-tabs\":\n        closeAllBrowserTabs();\n        break;\n    }\n  }\n\n  function resolveBrowserProxyInput(input) {\n    const raw = String(input ?? \"\").trim();\n    const envMatch = raw.match(/^env:([A-Za-z0-9_]+)$/i);\n    if (!envMatch) return raw;\n    const key = `OPENWORK_BROWSER_PROXY_${envMatch[1].toUpperCase()}`;\n    const value = String(process.env[key] ?? \"\").trim();\n    if (!value) throw new Error(`No proxy configured: set the ${key} environment variable to a proxy URL.`);\n    return value;\n  }\n\n  function parseBrowserProxyInput(input) {\n    const raw = resolveBrowserProxyInput(input);\n    if (!raw) return null;\n    const withScheme = /^[a-z][a-z0-9+.-]*:\\/\\//i.test(raw) ? raw : `http://${raw}`;\n    let url;\n    try {\n      url = new URL(withScheme);\n    } catch {\n      throw new Error(`Invalid proxy URL: ${raw}`);\n    }\n    if (!url.hostname || !url.port) {\n      throw new Error(\"Proxy must include host and port, e.g. http://user:pass@host:8080 or socks5://host:1080.\");\n    }\n    const scheme = url.protocol.replace(/:$/, \"\").toLowerCase();\n    return {","sourceCodeStart":404,"sourceCodeEnd":440,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/desktop/electron/browser-panel.mjs#L404-L440","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set OPENWORK_BROWSER_PROXY_<NAME> (e.g. export OPENWORK_BROWSER_PROXY_PRIMARY='http://user:pass@host:8080') before launching the app","Replace the 'env:...' value in the proxy config with the literal proxy URL","Verify the variable is visible to the Electron main process (not just your interactive shell)","Check for an empty-string value — whitespace-only also triggers this"],"exampleFix":"// before\nproxy: 'env:corp'\n// after (with env var set)\nexport OPENWORK_BROWSER_PROXY_CORP='socks5://gw.internal:1080'\nproxy: 'env:corp'","handlingStrategy":"validation","validationCode":"const key = 'OPENWORK_BROWSER_PROXY_PRIMARY';\nif (config.proxy.startsWith('env:') && !String(process.env[`OPENWORK_BROWSER_PROXY_${config.proxy.slice(4).toUpperCase()}`] ?? '').trim()) {\n  throw new Error(`${key} must be set before launching the app`);\n}","typeGuard":"function hasResolvedEnvProxy(raw, env = process.env) {\n  const m = /^env:([A-Za-z0-9_]+)$/i.exec(String(raw ?? '').trim());\n  return !m || Boolean(String(env[`OPENWORK_BROWSER_PROXY_${m[1].toUpperCase()}`] ?? '').trim());\n}","tryCatchPattern":"try {\n  await createBrowserPanel({ proxy: 'env:corp' });\n} catch (e) {\n  if (e.message.startsWith('No proxy configured: set the ')) {\n    // prompt user to set the env var or supply a literal proxy URL\n  } else throw e;\n}","preventionTips":["Export proxy env vars in the environment that actually launches the Electron app","Prefer literal proxy URLs in committed configs; reserve env: refs for secrets","Validate env references at startup, not at first browser use","Beware GUI/systemd launches that skip your shell profile"],"tags":["proxy","env-var","configuration"],"backgroundTag":"missing-env-var","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}