docmirror/dev-sidecar · warning
下载远程 domestic-domain-allowlist.txt 文件成功,但内容为空或内容太短,判断为无效的 do
Error message
下载远程 domestic-domain-allowlist.txt 文件成功,但内容为空或内容太短,判断为无效的 domestic-domain-allowlist.txt 文件:
What it means
A warning log in downloadDomesticDomainAllowListAsync (packages/core/src/shell/scripts/set-system-proxy/index.js:39-41). The remote domestic-domain allowlist file was downloaded with HTTP 200, but the body is null or shorter than 100 characters, so it is judged invalid and discarded — the local allowlist file is not updated. The system-proxy PAC/allowlist then keeps using the previously cached file.
Source
Thrown at packages/core/src/shell/scripts/set-system-proxy/index.js:40
}
function getDomesticDomainAllowListTmpFilePath () {
return path.join(config.get().server.setting.userBasePath, '/domestic-domain-allowlist.txt')
}
async function downloadDomesticDomainAllowListAsync () {
loadConfig()
const remoteFileUrl = config.get().proxy.remoteDomesticDomainAllowListFileUrl
log.info('开始下载远程 domestic-domain-allowlist.txt 文件:', remoteFileUrl)
request(remoteFileUrl, (error, response, body) => {
if (error) {
log.error(`下载远程 domestic-domain-allowlist.txt 文件失败: ${remoteFileUrl}, error:`, error, ', response:', response, ', body:', body)
return
}
if (response && response.statusCode === 200) {
if (body == null || body.length < 100) {
log.warn('下载远程 domestic-domain-allowlist.txt 文件成功,但内容为空或内容太短,判断为无效的 domestic-domain-allowlist.txt 文件:', remoteFileUrl, ', body:', body)
return
} else {
log.info('下载远程 domestic-domain-allowlist.txt 文件成功:', remoteFileUrl)
}
let fileTxt = body
try {
if (!fileTxt.includes('*.')) {
fileTxt = Buffer.from(fileTxt, 'base64').toString('utf8')
// log.debug('解析 base64 后的 domestic-domain-allowlist:', fileTxt)
}
} catch {
if (!fileTxt.includes('*.')) {
log.error(`远程 domestic-domain-allowlist.txt 文件内容即不是base64格式,也不是要求的格式,url: ${remoteFileUrl},body: ${body}`)
return
}
}
View on GitHub (pinned to 7710cd56cc)
Solutions
- Log/inspect the returned body (it is printed in the warning) to see what the server actually sent (HTML block page? empty string?).
- Check/correct `proxy.remoteDomesticDomainAllowListFileUrl` in `~/.dev-sidecar/config.json` to point at the official raw allowlist file URL.
- Verify with curl that the URL returns the real file (non-empty, >100 chars, containing `*.` domain entries or valid base64).
- Restore the previous local file `~/.dev-sidecar/domestic-domain-allowlist.txt` (the code leaves it untouched on this warning) or write a valid one manually.
- Retry later if it was a transient mirror/CDN glitch; the download runs again on the next system-proxy refresh.
Example fix
// before (config.json)
"proxy": { "remoteDomesticDomainAllowListFileUrl": "https://my-mirror.example/allowlist.txt" }
// after
"proxy": { "remoteDomesticDomainAllowListFileUrl": "https://raw.githubusercontent.com/docmirror/dev-sidecar/master/packages/core/src/shell/scripts/set-system-proxy/domestic-domain-allowlist.txt" } Defensive patterns
Strategy: validation
Validate before calling
const https = require('node:https')
function isValidAllowListUrl (url) {
return new Promise((resolve) => {
https.get(url, (res) => {
let n = 0
res.on('data', (c) => { n += c.length })
res.on('end', () => resolve(res.statusCode === 200 && n >= 100))
}).on('error', () => resolve(false))
})
}
// usage: if (!(await isValidAllowListUrl(cfg.proxy.remoteDomesticDomainAllowListFileUrl))) fixConfigFirst() Type guard
function isValidAllowListBody (body) {
return typeof body === 'string' && body.length >= 100
} Prevention
- Verify remoteDomesticDomainAllowListFileUrl with curl before configuring it: must return 200 with >100 chars containing `*.` entries or base64.
- Point the URL at raw file endpoints, not HTML pages or redirects that collapse to a 200 stub.
- Keep a good local fallback at ~/.dev-sidecar/domestic-domain-allowlist.txt; the code preserves it when this warning fires.
- Periodically re-check the mirror/CDN serving the file for empty or rate-limited responses.
When it happens
Trigger: The URL in config `proxy.remoteDomesticDomainAllowListFileUrl` returns HTTP 200 with an empty/short body — e.g. a mirror or CDN returning an empty stub, a redirect page captured as 200, a rate-limited/captcha response, or a custom self-hosted allowlist file that is truncated.
Common situations: Users pointing remoteDomesticDomainAllowListFileUrl at a custom gist/mirror whose content is empty or not the expected domain-list format; a proxy/firewall intercepting the request and returning a 200 block page; the upstream repo file temporarily unavailable via the mirror.
Related errors
- 下载远程配置成功,但内容为空:
- Unknown type DNS: ${server}, provider: ${provider}
- [speed] test error: ${this.hostname} ➜ ${item.host}:${this
- [speed] test by TCP error:
- newConfig 为空,不做任何操作
AI-assisted analysis of docmirror/dev-sidecar@7710cd56cc (2026-08-31).
Data as JSON: /api/errors/60baf432f1155e3b.
Report an issue: GitHub.