siyuan-note/siyuan · error

sync download did not complete

Error message

sync download did not complete

What it means

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.

Solutions

  1. Check that data sync is enabled and a cloud sync directory is configured (Conf.Sync.Enabled, CloudName)
  2. Ensure no other sync is running (checkSync rejects concurrent syncs) and retry after the current one finishes
  3. Look for a panic in the kernel log (logging.Recover) to find the real root cause of the incomplete download
Defensive patterns

Strategy: retry

Validate before calling

// ensure sync is usable before calling
if (!window.siyuan.config.sync.enabled) { enableSyncFirst(); }

Try / catch

err := model.SyncDataDownload()
if err != nil && strings.Contains(err.Error(), "sync download did not complete") {
    // check kernel log for panic; re-check sync state and retry after backoff
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/4d6bf6bfa6e59d78. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/sync.go:49

	"github.com/88250/go-humanize"
	"github.com/88250/gulu"
	"github.com/88250/lute/html"
	"github.com/gorilla/websocket"
	"github.com/siyuan-note/dejavu"
	"github.com/siyuan-note/dejavu/cloud"
	"github.com/siyuan-note/eventbus"
	"github.com/siyuan-note/logging"
	"github.com/siyuan-note/siyuan/kernel/cache"
	"github.com/siyuan-note/siyuan/kernel/conf"
	"github.com/siyuan-note/siyuan/kernel/filesys"
	"github.com/siyuan-note/siyuan/kernel/sql"
	"github.com/siyuan-note/siyuan/kernel/treenode"
	"github.com/siyuan-note/siyuan/kernel/util"
)

func SyncDataDownload() (err error) {
	err = errors.New("sync download did not complete")
	defer logging.Recover()

	if !checkSync(false, false, true) {
		return
	}

	scope := lanSyncScope()
	latestID := getSyncCloudLatestID()
	if "" != latestID {
		_, err = syncRemoteRequests.do(scope, latestID, func() error {
			lockSync()
			defer unlockSync()
			if syncRemoteRequests.isCompleted(scope, latestID) {
				return nil
			}
			err := syncDataDownloadLocked()
			if nil == err {
				completeCurrentSyncRemoteRequest(scope)

View on GitHub (pinned to 9f775e8a12)