siyuan-note/siyuan · error

Conf.Language(26)

Error message

Conf.Language(26)

What it means

Loading a snapshot document version requires the repository encryption key (Conf.Repo.Key) to be present, since snapshots are stored encrypted. If no repo key is configured (key length < 1), the kernel returns localized message key 26, which tells the user to set the repo key / passphrase first.

Source

Thrown at kernel/model/history_diff.go:402

		}, nil
	}
	return &loadedDocVersion{
		tree:    tree,
		title:   tree.Root.IALAttr("title"),
		rootID:  tree.Root.ID,
		raw:     data,
		large:   1024*1024 <= len(data),
		boxID:   boxID,
		history: historyRoot,
	}, nil
}

func loadSnapshotDocVersion(fileID string) (ret *loadedDocVersion, err error) {
	if "" == fileID {
		return nil, errors.New("snapshot file ID is required")
	}
	if 1 > len(Conf.Repo.Key) {
		return nil, errors.New(Conf.Language(26))
	}
	repo, err := newRepository()
	if err != nil {
		return nil, err
	}
	file, err := repo.GetFile(fileID)
	if err != nil {
		return nil, err
	}
	if !strings.HasSuffix(strings.ToLower(file.Path), ".sy") {
		return nil, errors.New("snapshot version is not a document")
	}
	repoPath := strings.TrimPrefix(file.Path, "/")
	pathParts := strings.SplitN(repoPath, "/", 2)
	data, err := repo.OpenFile(file)
	if err != nil {
		return nil, err
	}

View on GitHub (pinned to 8641553a1f)

Solutions

  1. Generate or enter the repo encryption key in Settings - About (or via the repo key API), then retry
  2. Check len(Conf.Repo.Key) before requesting snapshot versions
  3. Ensure i18n key 26 exists in all language files if localizing

Example fix

// before
loadDocVersion(fileID) // no repo key configured
// after
// set Conf.Repo.Key via the kernel repo-key API first, then:
loadDocVersion(fileID)
Defensive patterns

Strategy: validation

Validate before calling

if (!window.siyuan.config.repo.key) { showToast(i18n[26]); openRepoKeyDialog(); }

Type guard

const hasRepoKey = (conf: IConfig) => typeof conf.repo?.key === "string" && conf.repo.key.length > 0;

Try / catch

try { await api.loadDocVersion(fileID); } catch (e) { if (String(e) === i18n[26]) { await promptForRepoKey(); retry(); } }

Prevention

When it happens

Trigger: Calling loadDocVersion for a snapshot version when no sync/repo passphrase has ever been generated or entered in this workspace.

Common situations: Fresh workspace without encryption key setup; accessing history before configuring cloud sync and its passphrase; Conf not yet initialized with Repo.Key.

Understand the failure class

Background: "API key is required" / "API key not found" / "No API key was set": the missing-api-key error family across 16 libraries — this error's family across 16 libraries.

Related errors


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