siyuan-note/siyuan · error

Conf.Language(13)

Error message

Conf.Language(13)

What it means

validateCreateDoc rejects document paths whose base name starts with a dot ('.') because such files are treated as hidden/system entries, returning errors.New(Conf.Language(13)): "Cannot create a file starting with .". This guards the data directory layout, where dot-prefixed entries are reserved.

Source

Thrown at kernel/model/file.go:2291

	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 8641553a1f)

Solutions

  1. Strip or replace the leading dot in the desired doc title before creating
  2. Sanitize generated names: name = name.replace(/^\./, '') or prefix with a word
  3. Reject/adjust such names in the importing tool before calling the API

Example fix

// before
await fetchPost('/api/filetree/createDocWithMd', {notebook, path: '/' + fileName, markdown});
// after
const safe = fileName.replace(/^\.+/, '');
await fetchPost('/api/filetree/createDocWithMd', {notebook, path: '/' + safe, markdown});
Defensive patterns

Strategy: validation

Validate before calling

function assertNoLeadingDot(name) {
  if (/^\./.test(name.trim())) {
    throw new Error('doc name cannot start with a dot: ' + name);
  }
  return name;
}

Try / catch

try {
  await fetchPost('/api/filetree/createDocWithMd', {notebook, path: '/' + name, markdown});
} catch (e) {
  if (String(e).includes('starting with')) {
    // strip the dot and retry
  }
}

Prevention

When it happens

Trigger: POST /api/filetree/createDocWithMd or createDoc with a path whose base segment begins with '.', e.g. '/.config' or '/notes-123/.hidden'.

Common situations: Importers or sync tools deriving doc names from files like '.gitignore' or '.env'; template engines interpolating an empty variable so the name collapses into a leading dot; scripts renaming docs to '.tmp-...' style names.

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/029dfaff15714418. Report an issue: GitHub.