{"record":{"id":"029dfaff15714418","repo":"siyuan-note/siyuan","slug":"conf-language-13","errorCode":null,"errorMessage":"Conf.Language(13)","messagePattern":"Conf\\.Language\\(13\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/file.go","lineNumber":2291,"sourceCode":"\tif 512 < utf8.RuneCountInString(title) {\n\t\t// 限制笔记本名和文档名最大长度为 `512` https://github.com/siyuan-note/siyuan/issues/6299\n\t\treturn nil, errors.New(Conf.Language(106))\n\t}\n\n\tisEmpty := false\n\tif \"\" == title {\n\t\ttitle = Conf.Language(16)\n\t\tisEmpty = true\n\t} else if titleEmpty {\n\t\tisEmpty = true\n\t}\n\n\tbaseName := strings.TrimSpace(path.Base(p))\n\tif \"\" == util.GetTreeID(baseName) {\n\t\treturn nil, errors.New(Conf.Language(16))\n\t}\n\tif strings.HasPrefix(baseName, \".\") {\n\t\treturn nil, errors.New(Conf.Language(13))\n\t}\n\n\tbox, boxErr := getOpenedBox(boxID)\n\tif nil != boxErr {\n\t\treturn nil, boxErr\n\t}\n\n\tfolder := path.Dir(p)\n\thPath := \"/\" + title\n\tif \"/\" != folder {\n\t\tparentID := path.Base(folder)\n\t\tparentTree, loadErr := LoadTreeByBlockID(parentID)\n\t\tif nil != loadErr {\n\t\t\tlogging.LogErrorf(\"get parent tree [%s] failed\", parentID)\n\t\t\treturn nil, ErrBlockNotFound\n\t\t}\n\t\tparentPath := strings.TrimSuffix(parentTree.Path, \".sy\")\n\t\tif parentTree.Box != boxID || cleanBoxDocDir(parentPath) != cleanBoxDocDir(folder) {","sourceCodeStart":2273,"sourceCodeEnd":2309,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/file.go#L2273-L2309","documentation":"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.","triggerScenarios":"POST /api/filetree/createDocWithMd or createDoc with a path whose base segment begins with '.', e.g. '/.config' or '/notes-123/.hidden'.","commonSituations":"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.","solutions":["Strip or replace the leading dot in the desired doc title before creating","Sanitize generated names: name = name.replace(/^\\./, '') or prefix with a word","Reject/adjust such names in the importing tool before calling the API"],"exampleFix":"// before\nawait fetchPost('/api/filetree/createDocWithMd', {notebook, path: '/' + fileName, markdown});\n// after\nconst safe = fileName.replace(/^\\.+/, '');\nawait fetchPost('/api/filetree/createDocWithMd', {notebook, path: '/' + safe, markdown});","handlingStrategy":"validation","validationCode":"function assertNoLeadingDot(name) {\n  if (/^\\./.test(name.trim())) {\n    throw new Error('doc name cannot start with a dot: ' + name);\n  }\n  return name;\n}","typeGuard":null,"tryCatchPattern":"try {\n  await fetchPost('/api/filetree/createDocWithMd', {notebook, path: '/' + name, markdown});\n} catch (e) {\n  if (String(e).includes('starting with')) {\n    // strip the dot and retry\n  }\n}","preventionTips":["Sanitize names derived from dotfiles (.env, .gitignore) before import","Add a shared sanitizeDocName() used by all importers","Check both the leading character and whitespace-trimmed value"],"tags":["siyuan","kernel","create-doc","hidden-file","path-validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}