{"record":{"id":"4d6bf6bfa6e59d78","repo":"siyuan-note/siyuan","slug":"sync-download-did-not-complete","errorCode":null,"errorMessage":"sync download did not complete","messagePattern":"sync download did not complete","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/sync.go","lineNumber":49,"sourceCode":"\n\t\"github.com/88250/go-humanize\"\n\t\"github.com/88250/gulu\"\n\t\"github.com/88250/lute/html\"\n\t\"github.com/gorilla/websocket\"\n\t\"github.com/siyuan-note/dejavu\"\n\t\"github.com/siyuan-note/dejavu/cloud\"\n\t\"github.com/siyuan-note/eventbus\"\n\t\"github.com/siyuan-note/logging\"\n\t\"github.com/siyuan-note/siyuan/kernel/cache\"\n\t\"github.com/siyuan-note/siyuan/kernel/conf\"\n\t\"github.com/siyuan-note/siyuan/kernel/filesys\"\n\t\"github.com/siyuan-note/siyuan/kernel/sql\"\n\t\"github.com/siyuan-note/siyuan/kernel/treenode\"\n\t\"github.com/siyuan-note/siyuan/kernel/util\"\n)\n\nfunc SyncDataDownload() (err error) {\n\terr = errors.New(\"sync download did not complete\")\n\tdefer logging.Recover()\n\n\tif !checkSync(false, false, true) {\n\t\treturn\n\t}\n\n\tscope := lanSyncScope()\n\tlatestID := getSyncCloudLatestID()\n\tif \"\" != latestID {\n\t\t_, err = syncRemoteRequests.do(scope, latestID, func() error {\n\t\t\tlockSync()\n\t\t\tdefer unlockSync()\n\t\t\tif syncRemoteRequests.isCompleted(scope, latestID) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\terr := syncDataDownloadLocked()\n\t\t\tif nil == err {\n\t\t\t\tcompleteCurrentSyncRemoteRequest(scope)","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/sync.go#L31-L67","documentation":"SyncDataDownload initializes its return error to a sentinel 'sync download did not complete' and only replaces it once the download-side sync path (checkSync passes and syncDataLocked finishes) actually completes. This guarantees callers can never mistake an early return (panic recovery, checkSync failure, mid-function return) for a successful download. If you see this exact message, the function returned without completing the download.","triggerScenarios":"checkSync(false,false,true) returns false (sync disabled, another sync in progress, or auto-sync conditions unmet) and the function returns early; a panic occurs and logging.Recover swallows it; an internal return path leaves err unset.","commonSituations":"Calling the download sync API while auto-sync is disabled in settings; invoking two syncs concurrently so the second is rejected; a panic in the sync pipeline (network/IO crash) leaving the sentinel in place.","solutions":["Check that data sync is enabled and a cloud sync directory is configured (Conf.Sync.Enabled, CloudName)","Ensure no other sync is running (checkSync rejects concurrent syncs) and retry after the current one finishes","Look for a panic in the kernel log (logging.Recover) to find the real root cause of the incomplete download"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// ensure sync is usable before calling\nif (!window.siyuan.config.sync.enabled) { enableSyncFirst(); }","typeGuard":null,"tryCatchPattern":"err := model.SyncDataDownload()\nif err != nil && strings.Contains(err.Error(), \"sync download did not complete\") {\n    // check kernel log for panic; re-check sync state and retry after backoff\n}","preventionTips":["Verify sync is enabled and configured before calling download sync","Avoid concurrent sync calls; serialize them or wait for the running sync","Check kernel logs for recovered panics when this sentinel appears"],"tags":["go","sync","cloud","sentinel-error"],"backgroundTag":"sync-incomplete","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}