{"record":{"id":"a2f853c9afb61344","repo":"docmirror/dev-sidecar","slug":"pac-txt-pac-txt","errorCode":null,"errorMessage":"远程 pac.txt 文件下载失败或还在下载中，现使用内置 pac.txt 文件:","messagePattern":"远程 pac\\.txt 文件下载失败或还在下载中，现使用内置 pac\\.txt 文件:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/mitmproxy/src/options.js","lineNumber":104,"sourceCode":"\n    // 自动更新 pac.txt\n    if (!pacConfig.pacFileAbsolutePath && pacConfig.autoUpdate) {\n      // 异步下载远程 pac.txt 文件，并保存到本地；下载成功后，需要重启代理服务才会生效\n      downloadPacAsync(pacConfig)\n    }\n\n    // 优先使用本地已下载的 pac.txt 文件\n    if (!pacConfig.pacFileAbsolutePath && fs.existsSync(getTmpPacFilePath())) {\n      pacConfig.pacFileAbsolutePath = getTmpPacFilePath()\n      log.info('读取已下载的 pac.txt 文件:', pacConfig.pacFileAbsolutePath)\n    }\n\n    if (!pacConfig.pacFileAbsolutePath) {\n      log.info('setting.rootDir:', setting.rootDir)\n      pacConfig.pacFileAbsolutePath = path.join(setting.rootDir, pacConfig.pacFilePath)\n      log.info('读取内置的 pac.txt 文件:', pacConfig.pacFileAbsolutePath)\n      if (pacConfig.autoUpdate) {\n        log.warn('远程 pac.txt 文件下载失败或还在下载中，现使用内置 pac.txt 文件:', pacConfig.pacFileAbsolutePath)\n      }\n    }\n  }\n\n  // 插件列表\n  const middlewares = []\n\n  // 梯子插件：如果启用了，则添加到插件列表中\n  const overwallMiddleware = createOverwallMiddleware(overWallConfig)\n  if (overwallMiddleware) {\n    middlewares.push(overwallMiddleware)\n  }\n\n  const preSetIpList = matchUtil.domainMapRegexply(serverConfig.preSetIpList)\n\n  const options = {\n    host: serverConfig.host,\n    port: serverConfig.port,","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/docmirror/dev-sidecar/blob/7710cd56cce760c708f30b01d2d4056eb8c402d5/packages/mitmproxy/src/options.js#L86-L122","documentation":"When the overwall (over-the-wall) plugin's pac option is enabled, the library prefers an already-downloaded remote pac.txt. If no downloaded file exists yet (autoUpdate download is async, in progress, or failed), it falls back to the pac.txt bundled in the installation rootDir and logs this warning. Proxying still works, but rules come from the potentially outdated built-in file rather than the freshly downloaded one.","triggerScenarios":"Enabling `plugin.overwall.pac.enabled: true` with `autoUpdate: true` while no previously downloaded pac exists (first run, or the temp pac file was cleared) and downloadPacAsync has not completed — e.g. slow or blocked network to the remote pac URL — so getTmpPacFilePath() does not exist when options are built.","commonSituations":"First launch after enabling the overwall plugin; machine behind a firewall/proxy that cannot reach the remote pac URL; pac auto-update endpoint changed or deprecated; restarting the service immediately after enabling autoUpdate before the async download finishes.","solutions":["Wait for the async download to finish and restart the proxy service — the downloaded file is only picked up at startup.","Check network reachability of the remote pac URL (configure a working proxy or DNS for it if it is blocked).","Manually place a valid pac.txt at the expected temp path (getTmpPacFilePath) so it is picked up on next startup.","Keep using the built-in pac.txt (it is a valid fallback) and verify update behavior in logs; disable autoUpdate if the remote source is permanently unavailable.","Update to a newer dev-sidecar version if the remote pac URL in your version is stale."],"exampleFix":"// before (config expects remote pac but none downloaded yet)\n{\n  \"plugin\": { \"overwall\": { \"pac\": { \"enabled\": true, \"autoUpdate\": true } } }\n}\n// after (first run: download completes, then restart; or supply the file explicitly)\n{\n  \"plugin\": { \"overwall\": { \"pac\": { \"enabled\": true, \"autoUpdate\": true, \"pacFileAbsolutePath\": \"/home/user/dev-sidecar/pac.txt\" } } }\n}","handlingStrategy":"fallback","validationCode":"const fs = require('node:fs')\nfunction isPacReady (pacConfig) {\n  return Boolean(pacConfig.pacFileAbsolutePath) || fs.existsSync(pacTmpPath)\n}\n\nif (!isPacReady(pacConfig)) {\n  console.warn('remote pac.txt not downloaded yet; built-in pac.txt will be used')\n}","typeGuard":"function hasDownloadedPac (pacConfig, tmpPath, fs) {\n  return typeof pacConfig.pacFileAbsolutePath === 'string' || (typeof tmpPath === 'string' && fs.existsSync(tmpPath))\n}","tryCatchPattern":"try {\n  await downloadPacAsync(pacConfig) // or wait for the completion event before starting the server\n} catch (e) {\n  log.warn(`remote pac.txt download failed (${e.message}); proceeding with built-in pac.txt`)\n}","preventionTips":["After enabling pac autoUpdate, restart the proxy once after the download completes rather than immediately.","Ensure the remote pac URL is reachable from your network (firewall/DNS/proxy settings) and monitor the download log.","Optionally set pacFileAbsolutePath explicitly to a maintained local copy to remove dependence on the remote source.","Periodically verify the pac file in use is current; the built-in fallback may be outdated."],"tags":["network","pac","fallback","overwall"],"backgroundTag":"remote-resource-download-fallback","analyzedSha":"7710cd56cce760c708f30b01d2d4056eb8c402d5","analyzedAt":"2026-08-31T22:07:07.234Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}