{"record":{"id":"db772e1a879e4554","repo":"siyuan-note/siyuan","slug":"parent-path-not-found-s","errorCode":null,"errorMessage":"parent path not found: %s","messagePattern":"parent path not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/inbox.go","lineNumber":151,"sourceCode":"\t\tids := parseShorthandIDs(idsRaw)\n\t\tif len(ids) == 0 {\n\t\t\treturn fmt.Errorf(\"--ids is required (comma-separated shorthand IDs)\")\n\t\t}\n\n\t\thPath, _ := cmd.Flags().GetString(\"path\")\n\t\tif hPath == \"\" {\n\t\t\thPath = \"/\"\n\t\t}\n\t\tremoveAfter, _ := cmd.Flags().GetBool(\"remove-after\")\n\n\t\t// 解析目标父路径（hPath→fsPath）：hPath 指向新文档将要落入的父容器，\n\t\t// 其父目录必须已存在；不传或传 \"/\" 时落到笔记本根目录。\n\t\tparentPath := \"/\"\n\t\tparentDir := parentDir(hPath)\n\t\tif parentDir != \"/\" {\n\t\t\tbt := treenode.GetBlockTreeRootByHPath(notebook, parentDir)\n\t\t\tif bt == nil {\n\t\t\t\treturn fmt.Errorf(\"parent path not found: %s\", parentDir)\n\t\t\t}\n\t\t\tparentPath = strings.TrimSuffix(bt.Path, \".sy\")\n\t\t}\n\n\t\tif dryRun {\n\t\t\tfmt.Printf(\"[dry-run] Would convert %d shorthand(s) -> notebook %s (hPath: %s, removeAfter: %v)\\n\",\n\t\t\t\tlen(ids), notebook, hPath, removeAfter)\n\t\t\tfor _, id := range ids {\n\t\t\t\tfmt.Printf(\"[dry-run]   - %s\\n\", id)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\ttype result struct {\n\t\t\tID     string `json:\"id\"`\n\t\t\tTitle  string `json:\"title\"`\n\t\t\tDocID  string `json:\"docId\"`\n\t\t\tStatus string `json:\"status\"`","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/cli/cmd/inbox.go#L133-L169","documentation":"Thrown by the `inbox convert` subcommand when the parent container derived from `--path` (hPath) does not resolve to an existing document root. The code calls `treenode.GetBlockTreeRootByHPath(notebook, parentDir)`; a nil result means no document with that human-readable path exists in the target notebook, so there is nowhere to place the converted shorthand(s).","triggerScenarios":"Passing `--path /Notes/Sub` when no document named `Sub` exists under `/Notes` in the notebook; a typo in the hPath; targeting a notebook other than the one containing the parent. The check only runs when the parent dir is not `/` (root).","commonSituations":"Assuming the path is created on demand (it must already exist); mixing up notebook IDs; wrong hPath casing or separators; pointing at a leaf document instead of its container.","solutions":["Verify the parent document exists: `siyuan sql \"select * from blocks where hpath='<parentDir>' and box='<notebook>'\"`","Create the parent document in the GUI or via `import`/`block` first, then re-run convert","Omit `--path` (or pass `/`) to drop the shorthand at the notebook root"],"exampleFix":"// before\nsiyuan inbox convert --ids 1 --notebook 20240101 --path /Nonexistent/Parent\n// after\n# Create /Notes first, then:\nsiyuan inbox convert --ids 1 --notebook 20240101 --path /Notes","handlingStrategy":"validation","validationCode":"// Verify the parent document exists in the target notebook before convert:\nif parentDir != \"/\" {\n    if bt := treenode.GetBlockTreeRootByHPath(notebook, parentDir); bt == nil {\n        return fmt.Errorf(\"parent %q does not exist in notebook %s\", parentDir, notebook)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Create parent documents before targeting them with `--path`","Omit `--path` to land shorthands at the notebook root","Use `siyuan sql` to confirm an hpath exists in the target box","Remember hpaths are notebook-scoped — a path in one box is invisible in another"],"tags":["cli","validation","notebook","block-tree","hpath","inbox","go","siyuan"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}