siyuan-note/siyuan · error

Conf.Language(16)

Error message

Conf.Language(16)

What it means

validateCreateDoc derives the new doc's ID-bearing basename from the requested path via strings.TrimSpace(path.Base(p)) and runs util.GetTreeID on it. If that yields an empty string the path is not a usable document path, and the kernel returns errors.New(Conf.Language(16)) — literally the string "Untitled" — as the error. Practically it means the client passed a path whose basename cannot carry a doc ID (e.g. empty path or a bare '/').

Solutions

  1. Pass a well-formed path ending in a valid doc-ID basename, e.g. '/20240101120000-abcdefg' (parent doc path) — the kernel then generates the child ID.
  2. If you have no parent, create the doc at the notebook root with path set to a newly generated ID via /api/filetree/createDocWithMd or generate an ID client-side.
  3. Check for empty/undefined path values in the calling code before the request.
  4. Use /api/filetree/getDocTree to pick a real parent path.

Example fix

// before
await fetchPost("/api/filetree/createDoc", { notebook, path: parentPath || "", title });
// after
const p = parentPath || "/" + newDocID(); // valid '<yyMMddHHmmss>-<rand>' basename
await fetchPost("/api/filetree/createDoc", { notebook, path: p, title });
Defensive patterns

Strategy: validation

Validate before calling

function hasValidDocBasename(p) {
  const base = p.split("/").filter(Boolean).pop() || "";
  return /^\d{14}-[a-z0-9]{7}$/.test(base);
}
if (!hasValidDocBasename(p)) throw new Error("path needs a valid doc-ID basename");

Prevention

When it happens

Trigger: Calling /api/filetree/createDoc with an empty or root-only path value ('' or '/'); a client that builds the path by joining an empty parent ID with the title; passing a path missing the required <timestamp>-<random> ID segment format.

Common situations: Plugin code where parentPath is undefined/empty and string concatenation produced '/'; API scripts testing createDoc with minimal params and omitting path; UI state where the selected parent doc ID was not yet loaded.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/dbaea746d46f6e27. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/file.go:2306

func validateCreateDoc(boxID, p, title string, titleEmpty bool) (ret *createDocValidation, err error) {
	p = normalizeBoxDocPath(boxID, p)
	title = normalizeDocTitle(title)
	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

View on GitHub (pinned to 9f775e8a12)