siyuan-note/siyuan · error

Conf.Language(13)

Error message

Conf.Language(13)

What it means

validateCreateDoc rejects document paths whose basename starts with a dot: errors.New(Conf.Language(13)), "Cannot create a file starting with .". Dot-prefixed names are reserved for hidden/system files in the workspace (and would be ignored or mishandled by the indexer and sync), so the kernel forbids creating them as documents.

Solutions

  1. Strip or replace the leading dot in the title/path basename before the request (e.g. title.replace(/^\.+/, ""))
  2. Prefix dot-files with a safe character if the content must look hidden, e.g. 'dot-env'.
  3. Store such data in the notebook's assets folder or a plugin data directory instead of as a document.
  4. Validate the title client-side with /^[^.]/ before calling the API.

Example fix

// before
await fetchPost("/api/filetree/createDoc", { notebook, path, title: ".config" });
// after
const title = ".config".replace(/^\.+/u, "") || "config";
await fetchPost("/api/filetree/createDoc", { notebook, path, title });
Defensive patterns

Strategy: validation

Validate before calling

if (/^[.]/.test(title.trim())) {
  title = title.trim().replace(/^\.+/u, "") || "untitled";
}

Prevention

When it happens

Trigger: Calling /api/filetree/createDoc (or createDocWithMd) where the resulting path basename begins with '.', e.g. title='.hidden' or path='/...something'; passing a title like '.env' or '.gitignore' that becomes the doc filename.

Common situations: Scripts attempting to store config-like content as docs named '.foo'; clipper/import tools that pass raw filenames including leading dots; users typing names starting with a period when creating docs through API-driven UIs.

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

Appendix: source

Thrown at kernel/model/file.go:2309

	if 512 < utf8.RuneCountInString(title) {
		// 限制笔记本名和文档名最大长度为 `512` https://github.com/siyuan-note/siyuan/issues/6299
		return nil, errors.New(Conf.Language(106))
	}

	isEmpty := false
	if "" == title {
		title = Conf.Language(16)
		isEmpty = true
	} else if titleEmpty {
		isEmpty = true
	}

	baseName := strings.TrimSpace(path.Base(p))
	if "" == util.GetTreeID(baseName) {
		return nil, errors.New(Conf.Language(16))
	}
	if strings.HasPrefix(baseName, ".") {
		return nil, errors.New(Conf.Language(13))
	}

	box, boxErr := getOpenedBox(boxID)
	if nil != boxErr {
		return nil, boxErr
	}

	folder := path.Dir(p)
	hPath := "/" + title
	if "/" != folder {
		parentID := path.Base(folder)
		parentTree, loadErr := LoadTreeByBlockID(parentID)
		if nil != loadErr {
			logging.LogErrorf("get parent tree [%s] failed", parentID)
			return nil, ErrBlockNotFound
		}
		parentPath := strings.TrimSuffix(parentTree.Path, ".sy")
		if parentTree.Box != boxID || cleanBoxDocDir(parentPath) != cleanBoxDocDir(folder) {

View on GitHub (pinned to 9f775e8a12)