{"record":{"id":"d817226923af0273","repo":"siyuan-note/siyuan","slug":"sync-upload-did-not-complete","errorCode":null,"errorMessage":"sync upload did not complete","messagePattern":"sync upload did not complete","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/sync.go","lineNumber":142,"sourceCode":"}\n\nfunc completeCurrentSyncRemoteRequest(scope string) {\n\t// 完整同步可能在合并本地变更后生成新的最新索引，同时记录实际结果可覆盖两类通知到达顺序相反的情况。\n\trepo, err := newRepository()\n\tif nil != err {\n\t\tlogging.LogWarnf(\"create repo after remote sync failed: %s\", err)\n\t\treturn\n\t}\n\tlatest, err := repo.Latest()\n\tif nil != err {\n\t\tlogging.LogWarnf(\"get local latest after remote sync failed: %s\", err)\n\t\treturn\n\t}\n\tsyncRemoteRequests.complete(scope, latest.ID)\n}\n\nfunc SyncDataUpload() (err error) {\n\terr = errors.New(\"sync upload did not complete\")\n\tdefer logging.Recover()\n\n\tif !checkSync(false, false, true) {\n\t\treturn\n\t}\n\n\tunlock, ok := lockSyncRequest(&syncUploadRequests)\n\tif !ok {\n\t\treturn\n\t}\n\tdefer unlock()\n\tutil.BroadcastByType(\"main\", \"syncing\", 0, Conf.Language(81), nil)\n\n\tnow := util.CurrentTimeMillis()\n\tConf.Sync.Synced = now\n\n\terr = syncRepoUploadWithDNSRetry()\n\tcode := 1","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/sync.go#L124-L160","documentation":"SyncDataUpload is the mirror of SyncDataDownload for upload-side sync. Its return error is pre-seeded with 'sync upload did not complete' and only cleared when the upload sync actually runs to completion. Receiving this message means the function returned before a full upload sync finished (early checkSync exit or a recovered panic).","triggerScenarios":"checkSync(false,false,true) fails (sync not enabled, sync already locked/in progress) causing early return; panic recovered by logging.Recover; any internal early return without clearing err.","commonSituations":"Triggering upload sync while sync is disabled; concurrent sync attempt blocked by the sync lock; kernel crash/panic mid-upload leaving the sentinel error.","solutions":["Verify sync is enabled and configured before calling SyncDataUpload","Wait for any in-flight sync to finish and retry (checkSync enforces single concurrent sync)","Inspect kernel logs for recovered panics to identify why the upload aborted"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// check sync enabled state before invoking\nif (!conf.sync.enabled) return;","typeGuard":null,"tryCatchPattern":"err := model.SyncDataUpload()\nif err != nil && strings.Contains(err.Error(), \"sync upload did not complete\") {\n    // inspect logs for panic, confirm no sync in flight, retry\n}","preventionTips":["Ensure upload sync prerequisites (enabled, configured directory) are met","Do not overlap uploads with a running sync; wait for the lock","Monitor Conf.Sync.Stat after failures for the underlying reason"],"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"}