maotoumao/MusicFree · warning
当前无网络连接,请等待网络恢复后重试
Error message
当前无网络连接,请等待网络恢复后重试
What it means
This message is emitted by the downloader event handler when a download task fails with `DownloadFailReason.NetworkOffline`. It is not an exception but a user-facing warning: the app's download manager aborted a queued music download because the device had no active network connection. The app expects the user to wait for connectivity and retry.
Source
Thrown at src/entry/bootstrap/bootstrap.ts:291
handleLinkingUrl(data.url);
}
});
const initUrl = await Linking.getInitialURL();
if (initUrl) {
handleLinkingUrl(initUrl);
}
if (Config.getConfig("basic.autoPlayWhenAppStart")) {
TrackPlayer.play();
}
}
function bindEvents() {
// 下载事件
downloader.on(DownloaderEvent.DownloadError, (reason) => {
if (reason === DownloadFailReason.NetworkOffline) {
Toast.warn("当前无网络连接,请等待网络恢复后重试");
} else if (reason === DownloadFailReason.NotAllowToDownloadInCellular) {
if (getCurrentDialog()?.name !== "SimpleDialog") {
showDialog("SimpleDialog", {
title: "流量提醒",
content: "当前非WIFI环境,为节省流量,请到侧边栏设置中打开【使用移动网络下载】功能后方可继续下载",
});
}
}
});
downloader.on(DownloaderEvent.DownloadQueueCompleted, () => {
Toast.success("下载任务已完成");
});
}
export default async function () {
try {
getDefaultStore().set(bootstrapAtom, {View on GitHub (pinned to d118b18b3d)
Solutions
- Re-enable Wi-Fi or mobile data (or disable airplane mode) and re-trigger the download; most downloaders resume partially completed tasks.
- Verify connectivity in the app before queueing downloads (e.g. NetInfo.fetch() and check isConnected).
- If downloads keep failing while other apps are online, restart the app to rebuild the downloader's network state.
- Check VPN/proxy or private-DNS settings that may leave the link nominally up but unusable.
Example fix
// before: queueing without checking connectivity
await downloader.downloadTrack(musicItem);
// after
const state = await NetInfo.fetch();
if (state.isConnected) {
await downloader.downloadTrack(musicItem);
} else {
Toast.warn('当前无网络连接,请等待网络恢复后重试');
} Defensive patterns
Strategy: retry
Validate before calling
import NetInfo from '@react-native-community/netinfo';
export async function isNetworkAvailable() {
const state = await NetInfo.fetch();
return !!state.isConnected && state.isInternetReachable !== false;
}
if (!(await isNetworkAvailable())) {
Toast.warn('当前无网络连接,请等待网络恢复后重试');
return;
}
downloader.downloadTrack(musicItem); Try / catch
downloader.on(DownloaderEvent.DownloadError, async (reason) => {
if (reason === DownloadFailReason.NetworkOffline) {
Toast.warn('当前无网络连接,请等待网络恢复后重试');
const backoff = [5_000, 15_000, 60_000];
for (const ms of backoff) {
await new Promise(r => setTimeout(r, ms));
if (await isNetworkAvailable()) return retryDownload();
}
}
}); Prevention
- Check connectivity (NetInfo) before enqueueing downloads and queue offline requests for later.
- Listen to NetInfo 'connectionChange' to auto-resume paused downloads when the network returns.
- Surface download state in the UI so users understand why a task is stalled.
- On mobile data, gate downloads behind the 'use cellular network' setting to match user intent.
When it happens
Trigger: A music download is running or starting while the device is in airplane mode, Wi-Fi/mobile data is disabled, or the connection drops mid-download, causing the Downloader to emit `DownloaderEvent.DownloadError` with reason `NetworkOffline`.
Common situations: Starting a batch download in a subway/elevator; phone switches from Wi-Fi to a dead cellular connection; simulator/emulator with no network configured; VPN dropped killing all connectivity.
Related errors
AI-assisted analysis of maotoumao/MusicFree@d118b18b3d (2026-08-30).
Data as JSON: /api/errors/9e08c950d1d9286a.
Report an issue: GitHub.