{"record":{"id":"bb35d43e9e141b28","repo":"siyuan-note/siyuan","slug":"conf-language-118-bb35d4","errorCode":null,"errorMessage":"Conf.Language(118)","messagePattern":"Conf\\.Language\\(118\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/template_doc_tree.go","lineNumber":294,"sourceCode":"}\n\nfunc flattenTemplateDocTreeNodes0(nodes []*TemplateDocTreeNode) (ret []*TemplateDocTreeNode) {\n\tfor _, node := range nodes {\n\t\tret = append(ret, node)\n\t\tret = append(ret, flattenTemplateDocTreeNodes0(node.Children)...)\n\t}\n\treturn\n}\n\nfunc (collector *templateDocTreeCollector) validateLocations() error {\n\tbox := Conf.Box(collector.boxID)\n\tif nil == box {\n\t\treturn ErrBoxNotFound\n\t}\n\tallowCreateDeeper := nil != Conf.FileTree && Conf.FileTree.AllowCreateDeeper\n\tfor _, node := range flattenTemplateDocTreeNodes0(collector.nodes) {\n\t\tif depth := strings.Count(node.path, \"/\"); 7 < depth && !allowCreateDeeper {\n\t\t\treturn errors.New(Conf.Language(118))\n\t\t}\n\t\tif box.Exist(node.path) {\n\t\t\treturn fmt.Errorf(\"document path [%s] already exists\", node.path)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (collector *templateDocTreeCollector) buildTree(node *TemplateDocTreeNode, renderedTree *parse.Tree) {\n\trenderedRootID := renderedTree.Root.ID\n\trenderedTree.Box = collector.boxID\n\trenderedTree.Path = node.path\n\trenderedTree.HPath = node.HPath\n\trenderedTree.ID = node.ID\n\trenderedTree.Root.ID = node.ID\n\trenderedTree.Root.Spec = treenode.CurrentSpec\n\ttemplateIALs := parse.IAL2Map(renderedTree.Root.KramdownIAL)\n\trenderedTree.Root.KramdownIAL = [][]string{","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/template_doc_tree.go#L276-L312","documentation":"validateLocations checks each planned document's filesystem depth before the doc tree is created. SiYuan limits documents to 7 path segments unless FileTree.AllowCreateDeeper is enabled; if any node's path has more than 7 slashes and the setting is off, creation aborts with the localized message Conf.Language(118) (the standard \"maximum levels of docs\" warning). This is a config-dependent depth validation, not a parse error.","triggerScenarios":"Inserting a template whose createDocTree definition nests children deeper than 7 path levels in a notebook/workspace where \"Allow create deeper docs\" (设置 - 文件树 - 允许建立深层文档) is disabled.","commonSituations":"Deeply nested outlines (e.g. year/quarter/month/week/day topics), templates copied from users who had deep-docs enabled, multi-tenant sync where one workspace allows deep docs and another does not.","solutions":["Enable deep document creation: 设置 - 文件树 - 允许建立深层文档 (FileTree.AllowCreateDeeper).","Flatten the createDocTree definition so no document is nested more than 7 levels.","Move the target document to a shorter parent path to reduce resulting depth."],"exampleFix":"// before (conf)\nFileTree.AllowCreateDeeper = false  // template nests 9 levels\n// after\nFileTree.AllowCreateDeeper = true, or flatten the definition to <= 7 levels","handlingStrategy":"validation","validationCode":"// check depth (path slash count) against the workspace setting before rendering\nconst maxDepth = window?.siyuan?.conf?.fileTree?.allowCreateDeeper ? Infinity : 7;\nconst tooDeep = flatten(nodes).some((n) => n.path.split(\"/\").length - 1 > maxDepth);","typeGuard":null,"tryCatchPattern":"try {\n  await insertTemplateWithDocTree(def);\n} catch (e) {\n  if (e && e.code === 118 || /深层|deeper|levels/i.test(String(e.msg || e))) {\n    // prompt user to enable deep docs or flatten the tree\n  }\n}","preventionTips":["Enable 设置 - 文件树 - 允许建立深层文档 if deep nesting is required","Compute template nesting depth against the target workspace's setting beforehand","Cap template child nesting at 7 levels for portable templates"],"tags":["template","depth-limit","configuration"],"backgroundTag":"invalid-config-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"}