{"record":{"id":"9e08c950d1d9286a","repo":"maotoumao/MusicFree","slug":"error-9e08c9","errorCode":null,"errorMessage":"当前无网络连接，请等待网络恢复后重试","messagePattern":"当前无网络连接，请等待网络恢复后重试","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/entry/bootstrap/bootstrap.ts","lineNumber":291,"sourceCode":"            handleLinkingUrl(data.url);\n        }\n    });\n    const initUrl = await Linking.getInitialURL();\n    if (initUrl) {\n        handleLinkingUrl(initUrl);\n    }\n\n    if (Config.getConfig(\"basic.autoPlayWhenAppStart\")) {\n        TrackPlayer.play();\n    }\n}\n\n\nfunction bindEvents() {\n    // 下载事件\n    downloader.on(DownloaderEvent.DownloadError, (reason) => {\n        if (reason === DownloadFailReason.NetworkOffline) {\n            Toast.warn(\"当前无网络连接，请等待网络恢复后重试\");\n        } else if (reason === DownloadFailReason.NotAllowToDownloadInCellular) {\n            if (getCurrentDialog()?.name !== \"SimpleDialog\") {\n                showDialog(\"SimpleDialog\", {\n                    title: \"流量提醒\",\n                    content: \"当前非WIFI环境，为节省流量，请到侧边栏设置中打开【使用移动网络下载】功能后方可继续下载\",\n                });\n            }\n        }\n    });\n\n    downloader.on(DownloaderEvent.DownloadQueueCompleted, () => {\n        Toast.success(\"下载任务已完成\");\n    });\n}\n\nexport default async function () {\n    try {\n        getDefaultStore().set(bootstrapAtom, {","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/maotoumao/MusicFree/blob/d118b18b3d0c904400f7eea7bf99c0ceec6c1aee/src/entry/bootstrap/bootstrap.ts#L273-L309","documentation":"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.","triggerScenarios":"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`.","commonSituations":"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.","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."],"exampleFix":"// before: queueing without checking connectivity\nawait downloader.downloadTrack(musicItem);\n\n// after\nconst state = await NetInfo.fetch();\nif (state.isConnected) {\n    await downloader.downloadTrack(musicItem);\n} else {\n    Toast.warn('当前无网络连接，请等待网络恢复后重试');\n}","handlingStrategy":"retry","validationCode":"import NetInfo from '@react-native-community/netinfo';\n\nexport async function isNetworkAvailable() {\n    const state = await NetInfo.fetch();\n    return !!state.isConnected && state.isInternetReachable !== false;\n}\n\nif (!(await isNetworkAvailable())) {\n    Toast.warn('当前无网络连接，请等待网络恢复后重试');\n    return;\n}\ndownloader.downloadTrack(musicItem);","typeGuard":null,"tryCatchPattern":"downloader.on(DownloaderEvent.DownloadError, async (reason) => {\n    if (reason === DownloadFailReason.NetworkOffline) {\n        Toast.warn('当前无网络连接，请等待网络恢复后重试');\n        const backoff = [5_000, 15_000, 60_000];\n        for (const ms of backoff) {\n            await new Promise(r => setTimeout(r, ms));\n            if (await isNetworkAvailable()) return retryDownload();\n        }\n    }\n});","preventionTips":["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."],"tags":["network","download","offline"],"backgroundTag":"network-offline","analyzedSha":"d118b18b3d0c904400f7eea7bf99c0ceec6c1aee","analyzedAt":"2026-08-30T11:49:12.932Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}