siyuan-note/siyuan · error

Conf.Language(26)

Error message

Conf.Language(26)

What it means

Snapshot files in the encrypted repo store are encrypted at rest, so opening one requires the repository key. loadSnapshotDocVersion checks Conf.Repo.Key before constructing the repository; when no repo key is configured, it returns the localized message 26 (the 'repo key is required / passphrase needed' prompt) instead of attempting repo access.

Solutions

  1. Set up / re-enter the repository passphrase via the sync settings so Conf.Repo.Key is populated, then retry.
  2. If the repo key was lost, the snapshot content is unrecoverable from this workspace — restore from a source that knows the passphrase.
  3. Programmatically check len(Conf.Repo.Key) > 0 (or the repo-init state API) before requesting snapshot versions.
  4. Verify the correct workspace is open; a different workspace may have no initialized repo.

Example fix

// before: snapshot diff without repo key
loadDocVersion(snapshotFileID) -> Conf.Language(26)
// after: initialize repo first
POST /api/repo/initRepoKey { "password": "..." }
loadDocVersion(snapshotFileID)
Defensive patterns

Strategy: validation

Validate before calling

// Go: confirm a repo key exists before snapshot version access
if 1 > len(Conf.Repo.Key) {
    return errors.New("repository key not configured; initialize repo key first")
}

Try / catch

catch (e) { if (e.msg.includes(Langs[26])) { openRepoKeySetupDialog(); } else { throw e; } }

Prevention

When it happens

Trigger: loadDocVersion in snapshot mode with a valid fileID while the workspace has no repository key set (Conf.Repo.Key empty) — i.e. cloud/snapshot sync was never initialized with a passphrase, or the key was cleared.

Common situations: Fresh workspace restore where the repo key was not re-entered; user cleared or reset the sync passphrase; opening snapshots before setting up cloud sync; Conf.Repo.Key lost after config corruption.

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@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/a124cc6221e46941. Report an issue: GitHub.

Appendix: 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 9f775e8a12)