siyuan-note/siyuan · warning

Conf.Language(222)

Error message

Conf.Language(222)

What it means

MoveLocalShorthands migrates locally captured shorthand (quick-capture) files into a notebook. It first tries a non-blocking acquire of the global sync lock (syncLock.TryLock); when sync/other consumers already hold the lock it aborts with the localized message Conf.Language(222) ("Please try again later" — sync in progress) instead of waiting or racing with synchronization.

Source

Thrown at kernel/model/shortcuts.go:47

	"sync"
	"time"

	"github.com/88250/gulu"
	"github.com/88250/lute/ast"
	"github.com/88250/lute/parse"
	"github.com/siyuan-note/logging"
	"github.com/siyuan-note/siyuan/kernel/cache"
	"github.com/siyuan-note/siyuan/kernel/treenode"
	"github.com/siyuan-note/siyuan/kernel/util"
)

func MoveLocalShorthands(boxID string) (retIDs []string, err error) {
	shorthandsDir := filepath.Join(util.ShortcutsPath, "shorthands")
	if !gulu.File.IsDir(shorthandsDir) {
		return
	}
	if !syncLock.TryLock() {
		err = errors.New(Conf.Language(222))
		return
	}
	defer syncLock.Unlock()

	entries, err := os.ReadDir(shorthandsDir)
	if nil != err {
		logging.LogErrorf("read dir [%s] failed: %s", shorthandsDir, err)
		return
	}
	if !IsShorthandSaveBoxAvailable(boxID) {
		err = errors.New(Conf.Language(375))
		return
	}

	assetsDir := filepath.Join(util.DataDir, "assets")
	for _, entry := range entries {
		if entry.IsDir() && "assets" == entry.Name() {
			assetsEntries, readErr := os.ReadDir(filepath.Join(shorthandsDir, entry.Name()))

View on GitHub (pinned to 8641553a1f)

Solutions

  1. Retry after the sync finishes — the kernel reports this condition to the UI, which will retry on the next trigger
  2. Manually run sync first, wait for completion, then trigger shorthand consumption
  3. In scripts/tests, serialize calls or wait for syncLock availability before invoking

Example fix

null
Defensive patterns

Strategy: retry

Validate before calling

// Probe lock availability before the call (best effort)
if !syncLock.TryLock() { return errSyncBusy }; syncLock.Unlock()

Try / catch

retIDs, err := MoveLocalShorthands(boxID)
if err != nil && strings.Contains(err.Error(), Conf.Language(222)) {
    time.Sleep(5 * time.Second)
    retIDs, err = MoveLocalShorthands(boxID) // retry after sync completes
}

Prevention

When it happens

Trigger: Calling MoveLocalShorthands (directly or via moveLocalShorthands/consumeShorthands) while data sync is running or another goroutine holds syncLock — e.g. quick capture consumption triggered concurrently with an auto-sync cycle.

Common situations: Auto sync kicks in right when the user opens the app and shorthands are consumed; a long sync (large initial upload) overlaps with shorthand movement; tests running multiple MoveLocalShorthands concurrently.

Related errors


AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11). Data as JSON: /api/errors/7e8ce81b9f7d6b8b. Report an issue: GitHub.