{"record":{"id":"d1c7c1bd35f1ad01","repo":"docmirror/dev-sidecar","slug":"gsettings-d1c7c1","errorCode":null,"errorMessage":"gsettings 关闭系统代理失败（可能无桌面环境）","messagePattern":"gsettings 关闭系统代理失败（可能无桌面环境）","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/core/src/shell/scripts/set-system-proxy/index.js","lineNumber":618,"sourceCode":"\n      // 设置排除域名（ignore-hosts）\n      const excludeIpStr = getProxyExcludeIpStr('\\', \\'')\n      setProxyCmd.push(`gsettings set org.gnome.system.proxy ignore-hosts \"['${excludeIpStr}']\"`)\n\n      try {\n        await exec(setProxyCmd)\n      } catch (e) {\n        log.warn('gsettings 设置系统代理失败（可能无桌面环境），环境变量已设置')\n      }\n    } else { // 关闭代理\n      if (setEnv) {\n        removeProxyEnvFromShellProfile()\n      }\n\n      try {\n        await exec(['gsettings set org.gnome.system.proxy mode none'])\n      } catch (e) {\n        log.warn('gsettings 关闭系统代理失败（可能无桌面环境）')\n      }\n    }\n  },\n  async mac (exec, params = {}) {\n    const wifiAdaptor = await getMacNetworkService(exec)\n    const { ip, port, setEnv } = params\n\n    let cmds\n    if (ip != null) { // 设置代理\n      // 延迟加载config\n      loadConfig()\n\n      // https\n      cmds = [`networksetup -setsecurewebproxy \"${wifiAdaptor}\" ${ip} ${port}`]\n      // http\n      if (config.get().proxy.proxyHttp) {\n        cmds.push(`networksetup -setwebproxy \"${wifiAdaptor}\" ${ip} ${port - 1}`)\n      } else {","sourceCodeStart":600,"sourceCodeEnd":636,"githubUrl":"https://github.com/docmirror/dev-sidecar/blob/7710cd56cce760c708f30b01d2d4056eb8c402d5/packages/core/src/shell/scripts/set-system-proxy/index.js#L600-L636","documentation":"Non-fatal warning in the Linux system-proxy setter when disabling the proxy. After (optionally) removing the proxy environment variables from the shell profile, the code runs `gsettings set org.gnome.system.proxy mode none` to clear the GNOME desktop proxy. If that command fails, this warning is logged and the operation continues without throwing — meaning the GNOME desktop proxy may remain set to manual even though the env vars were removed.","triggerScenarios":"executor.linux() with ip == null (proxy off): no gsettings binary, no D-Bus/desktop session (SSH, service, headless), dconf write failure, or schema not installed.","commonSituations":"Headless servers where GNOME proxy was never set (harmless); turning the proxy off from an SSH session after enabling it in the desktop; minimal DEs without gsettings.","solutions":["If headless, ignore — nothing GNOME-side was ever set; confirm env vars were removed from your shell profile and run `source ~/.bashrc` (or `unset HTTPS_PROXY HTTP_PROXY`)","If a desktop proxy was actually set earlier, run `gsettings set org.gnome.system.proxy mode none` inside the desktop session (with D-Bus available) to clear it","Check that GNOME still has a stale manual proxy via `gsettings get org.gnome.system.proxy mode` and clear host/port keys manually if needed"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"const { execSync } = require('node:child_process')\nfunction gnomeProxyIsManual() {\n  try {\n    return execSync('gsettings get org.gnome.system.proxy mode').toString().trim() === \"'manual'\"\n  } catch { return false }\n}\n// if true after turning proxy off, GNOME proxy needs manual cleanup in a desktop session","typeGuard":null,"tryCatchPattern":"// Library swallows the failure; verify cleanup yourself:\ntry {\n  if (gnomeProxyIsManual()) {\n    execSync('gsettings set org.gnome.system.proxy mode none')\n  }\n} catch (e) {\n  console.warn('Run this inside a desktop session with D-Bus:', e.message)\n}","preventionTips":["Toggle the proxy off from the same (desktop) session where you enabled it","After disabling on Linux, check `gsettings get org.gnome.system.proxy mode` for stale 'manual'","Unset HTTP(S)_PROXY in your shell or re-source the profile after turning the proxy off"],"tags":["linux","gsettings","gnome","headless","cleanup"],"backgroundTag":"gsettings-no-desktop-environment","analyzedSha":"7710cd56cce760c708f30b01d2d4056eb8c402d5","analyzedAt":"2026-08-31T22:07:07.234Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}