siyuan-note/siyuan · error

Conf.Language(151)

Error message

Conf.Language(151)

What it means

SiYuan's CreateSnapshotFromMarkedDocument-style repo API rejects a snapshot/repo name that contains filesystem-unsafe characters. The kernel validates the user-supplied name with gulu.File.IsValidFilename and returns a localized message (i18n key 151: "Do not include symbols \\ / : * ? " ' < > |") instead of panicking. This is a client-input validation guard before touching the repository.

Solutions

  1. Remove the illegal characters \ / : * ? " ' < > | from the name parameter before calling the API.
  2. Sanitize programmatically by stripping everything outside letters, digits, hyphens, underscores and CJK characters.
  3. Retry the request with a plain descriptive name such as a date string like '2026-09-11'.

Example fix

// before
await fetchPost('/api/repo/createRepoNotebookSnapshot', {name: 'docs/backup: v1'});
// after
const safeName = rawName.replace(/\\/:*?"'<>|/g, '-');
await fetchPost('/api/repo/createRepoNotebookSnapshot', {name: safeName});
Defensive patterns

Strategy: validation

Validate before calling

const INVALID = /[\\/:*?"'<>|]/;
if (!name || INVALID.test(name)) {
  throw new Error('Snapshot name contains illegal characters: \\ / : * ? " \' < > |');
}

Type guard

const isValidRepoName = (n) => typeof n === 'string' && n.length > 0 && !/[\\/:*?"'<>|]/.test(n);

Prevention

When it happens

Trigger: Calling the kernel API (e.g. /api/repo/createRepoFromRemote or snapshot creation endpoints that take a name parameter) with a name containing \ / : * ? " ' < > |, or an empty name (which instead hits key 142).

Common situations: Users typing snapshot/repo names copied from Windows paths or URLs; automated scripts generating names with timestamps like '2026/09/11'; names pasted with quotes or angle brackets from HTML.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at kernel/model/repository.go:1720

}

func TagSnapshot(id, name string) (err error) {
	assetDownloadSourceMu.RLock()
	defer assetDownloadSourceMu.RUnlock()
	if 1 > len(Conf.Repo.Key) {
		err = errors.New(Conf.Language(26))
		return
	}

	name = util.RemoveInvalid(name)
	name = strings.TrimSpace(name)
	if "" == name {
		err = errors.New(Conf.Language(142))
		return
	}

	if !gulu.File.IsValidFilename(name) {
		err = errors.New(Conf.Language(151))
		return
	}

	repo, err := newRepositoryWithAssetSourceLocked()
	if err != nil {
		return
	}

	index, err := repo.GetIndex(id)
	if err != nil {
		return
	}

	if err = repo.AddTag(index.ID, name); err != nil {
		msg := fmt.Sprintf("Add tag to data snapshot [%s] failed: %s", index.ID, err)
		util.PushStatusBar(msg)
		return
	}

View on GitHub (pinned to 8641553a1f)