{"record":{"id":"92bddb6e27bfaaf1","repo":"siyuan-note/siyuan","slug":"unsupported-renderdocref-query-mode-s","errorCode":null,"errorMessage":"unsupported renderDocRef query mode [%s]","messagePattern":"unsupported renderDocRef query mode \\[(.+?)\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/template_doc_tree.go","lineNumber":274,"sourceCode":"\t\t\t\treturn node.Children, nil\n\t\t\t}\n\t\t}\n\t\treturn []*TemplateDocTreeNode{}, nil\n\tcase \"path\":\n\t\thPath, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn \"\", errors.New(\"renderDocRef path target must be a document path\")\n\t\t}\n\t\trequestedPath := path.Clean(hPath)\n\t\tfor _, node := range flattenTemplateDocTreeNodes0(collector.nodes) {\n\t\t\trelativePath := strings.TrimPrefix(node.HPath, collector.rootHPath)\n\t\t\tif node.HPath == requestedPath || relativePath == requestedPath {\n\t\t\t\treturn fmt.Sprintf(\"((%s %q))\", node.RootID, node.HPath), nil\n\t\t\t}\n\t\t}\n\t\treturn \"\", nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported renderDocRef query mode [%s]\", mode)\n\t}\n}\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) {","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/template_doc_tree.go#L256-L292","documentation":"renderDocRef supports only the modes 'children' and 'path'. Any other mode string reaches the default branch of the switch and is rejected with this error naming the unsupported mode. It is a guard against typos and future/unknown mode names in templates.","triggerScenarios":"A template action calls renderDocRef with a mode other than \"children\" or \"path\" — typically a typo like \"child\", \"byPath\", or a mode invented by the template author.","commonSituations":"Typos in template files; copying action syntax from a different template subsystem with different mode names; older templates using mode names that were never supported.","solutions":["Change the mode to \"children\" (query children by document ID) or \"path\" (resolve a block ref by document path)","Fix typos in the template's renderDocRef action","Check the supported mode list in kernel/model/template_doc_tree.go renderDocRef"],"exampleFix":"// before\n{{renderDocRef \"childrens\" \"20240101120000-abcdefg\"}}\n// after\n{{renderDocRef \"children\" \"20240101120000-abcdefg\"}}","handlingStrategy":"validation","validationCode":"var validModes = map[string]bool{\"children\": true, \"path\": true}\nif !validModes[mode] { return fmt.Errorf(\"unsupported mode %q\", mode) }","typeGuard":null,"tryCatchPattern":"out, err := collector.renderDocRef(mode, value)\nif err != nil && strings.Contains(err.Error(), \"unsupported renderDocRef query mode\") {\n  // correct the mode name in the template\n}","preventionTips":["Only use \"children\" or \"path\" as renderDocRef modes","Lint templates for known action mode names","Check the renderDocRef switch in kernel/model/template_doc_tree.go when unsure"],"tags":["go","template","invalid-argument"],"backgroundTag":"invalid-enum-value","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}