{"record":{"id":"5c08aae783038462","repo":"docmirror/dev-sidecar","slug":"macos-5c08aa","errorCode":null,"errorMessage":"macOS 代理服务检测：获取网络服务列表失败:","messagePattern":"macOS 代理服务检测：获取网络服务列表失败:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/core/src/shell/scripts/set-system-proxy/index.js","lineNumber":256,"sourceCode":"  return services[0]\n}\n\nasync function getMacNetworkService (exec) {\n  try {\n    const routeOutput = await exec('route -n get 0.0.0.0')\n    const device = parseMacRouteDevice(routeOutput)\n    if (device) {\n      log.info('macOS 代理服务检测：当前网络设备:', device)\n      try {\n        const networkServiceOrder = await exec('networksetup -listnetworkserviceorder')\n        const matchedService = parseMacNetworkServiceByDevice(networkServiceOrder, device)\n        if (matchedService) {\n          log.info('macOS 代理服务检测：通过设备名匹配到网络服务:', matchedService)\n          return matchedService\n        }\n        log.warn('macOS 代理服务检测：未通过设备名匹配到网络服务，尝试备用方法')\n      } catch (e) {\n        log.warn('macOS 代理服务检测：获取网络服务列表失败:', e.message, '，尝试备用方法')\n      }\n    } else {\n      log.warn('macOS 代理服务检测：未检测到当前网络设备，尝试备用方法')\n    }\n  } catch (e) {\n    log.warn('macOS 代理服务检测：获取路由信息失败:', e.message, '，尝试备用方法')\n  }\n\n  try {\n    const allServicesOutput = await exec('networksetup -listallnetworkservices')\n    const fallbackService = pickMacNetworkService(allServicesOutput)\n    if (fallbackService) {\n      log.info('macOS 代理服务检测：通过服务列表备用方法找到网络服务:', fallbackService)\n      return fallbackService\n    }\n    log.warn('macOS 代理服务检测：未通过服务列表找到可用网络服务')\n  } catch (e) {\n    log.warn('macOS 代理服务检测：获取所有网络服务列表失败:', e.message)","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/docmirror/dev-sidecar/blob/7710cd56cce760c708f30b01d2d4056eb8c402d5/packages/core/src/shell/scripts/set-system-proxy/index.js#L238-L274","documentation":"Non-fatal warning from getMacNetworkService(). The inner `exec('networksetup -listnetworkserviceorder')` call threw (spawn failure, non-zero exit, or command not found), so the device-to-service mapping step is skipped and the function proceeds to the fallback strategy. It signals that the networksetup binary itself failed rather than that parsing found no match.","triggerScenarios":"`networksetup` is not on PATH or cannot be spawned from the DevSidecar child process; networksetup exits non-zero (e.g. restricted environment, sandboxed process, corrupted network configuration daemon state); the exec wrapper rejects on any stderr/non-zero code.","commonSituations":"Running under a heavily restricted environment (CI, container with macOS shell wrappers); macOS system configuration daemon (configd) temporarily unresponsive; PATH differences when launched from Finder vs terminal so /usr/sbin is not found.","solutions":["No immediate action — the code falls back to `networksetup -listallnetworkservices`; check the attached e.message in the log for the real cause","Confirm `which networksetup` resolves (normally /usr/sbin/networksetup) when launching the app, and launch DevSidecar from a normal user session","If networksetup persistently fails, reboot or check `systemstatus`/configd health; as a last resort set the macOS system proxy manually and disable automatic proxy setup"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"const { execSync } = require('node:child_process')\nfunction networksetupAvailable() {\n  try { execSync('networksetup -listallnetworkservices', { stdio: 'ignore' }); return true }\n  catch { return false }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await DevSidecar.api.config.set('proxy.enable', true)\n} catch (e) {\n  log.warn('system proxy setup failed:', e.message)\n  // instruct user to set macOS proxy manually\n}","preventionTips":["Launch the app from a normal user session so /usr/sbin is on PATH","Confirm `which networksetup` resolves in the launch environment","Check the logged e.message to distinguish spawn errors from non-zero exits"],"tags":["macos","networksetup","exec-failure","fallback"],"backgroundTag":"command-exec-failed","analyzedSha":"7710cd56cce760c708f30b01d2d4056eb8c402d5","analyzedAt":"2026-08-31T22:07:07.234Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}