{"record":{"id":"d385b461c967f8e3","repo":"siyuan-note/siyuan","slug":"target-human-readable-path-not-found-s","errorCode":null,"errorMessage":"target human-readable path not found: %s","messagePattern":"target human-readable path not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/document.go","lineNumber":344,"sourceCode":"\t}\n\n\ttargetHPath := path.Clean(\"/\" + strings.TrimPrefix(hpath, \"/\"))\n\tif \"/\" == targetHPath {\n\t\treturn \"/\", nil\n\t}\n\n\tsourceTitle := path.Base(path.Clean(sourceHPath))\n\tif sourceTitle == path.Base(targetHPath) {\n\t\ttargetHPath = path.Dir(targetHPath)\n\t\tif \"/\" == targetHPath {\n\t\t\treturn \"/\", nil\n\t\t}\n\t}\n\n\tif targetPath, found := lookup(targetHPath); found {\n\t\treturn targetPath, nil\n\t}\n\treturn \"\", fmt.Errorf(\"target human-readable path not found: %s\", targetHPath)\n}\n\nvar documentSearchCmd = &cobra.Command{\n\tUse:   \"search <keyword>\",\n\tShort: \"Search documents by keyword\",\n\tArgs:  cobra.MinimumNArgs(1),\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tkeyword := args[0]\n\t\tif keyword == \"\" {\n\t\t\treturn fmt.Errorf(\"keyword is required\")\n\t\t}\n\t\tdocs := model.SearchDocs(keyword, false, nil)\n\t\tswitch outputFormat {\n\t\tcase \"json\":\n\t\t\tdata, _ := json.MarshalIndent(docs, \"\", \"  \")\n\t\t\tfmt.Println(string(data))\n\t\tdefault:\n\t\t\tif len(docs) == 0 {","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/cli/cmd/document.go#L326-L362","documentation":"The `document move` path-resolution helper resolveDocumentMovePath calls a `lookup(targetHPath)` to translate a human-readable path (e.g. /Parent/Child) into a concrete .sy path inside the destination notebook. When lookup finds no matching entry — i.e. no document/folder with that human-readable path exists in the target notebook — the helper returns this error. It fires after --id and --notebook pass, during target-path computation, so it is a data/lookup error rather than a flag error.","triggerScenarios":"Passing --hpath pointing to a folder path that does not exist in the destination notebook; moving a document whose source title collides with the target name and the parent directory in the target does not exist; using --hpath from a different notebook's hierarchy; typos or wrong separators in --hpath; the destination notebook being empty.","commonSituations":"Assuming the target parent folder exists when it does not; expecting --hpath to auto-create intermediate folders; workspace/notebook mismatch; the lookup table not yet indexed for the destination notebook; passing a leading/trailing slash inconsistently with how paths are stored.","solutions":["Create the target parent document/folder in the destination notebook first (via `document create`), then retry the move.","Verify the target human-readable path exists: `siyuan document list --notebook <dest> --hpath <parent>` and confirm it appears.","Omit --hpath to let the document move to the notebook root, or pass a --path (concrete .sy path) instead of an hpath if you know it.","Check the exact spelling, case, and slash structure of --hpath against the destination's hierarchy.","Ensure the destination notebook is open and indexed before moving."],"exampleFix":"// before\nsiyuan document move --id <id> --notebook <dest> --hpath /Nonexistent/Parent\n// after\n# create the parent folder first, then move\nsiyuan document create --notebook <dest> --title Parent\nsiyuan document move --id <id> --notebook <dest> --hpath /Parent","handlingStrategy":"validation","validationCode":"# ensure the target human-readable path exists in the destination notebook before moving\nsiyuan document list --notebook \"$DEST_NB\" --hpath \"$(dirname \"$HPATH\")\" | grep -q . || { echo \"target hpath not found; create parent first\" >&2; exit 2; }\nsiyuan document move --id \"$DOC_ID\" --notebook \"$DEST_NB\" --hpath \"$HPATH\"","typeGuard":"// Go: check the destination hierarchy contains the parent before resolving\nfunc hpathExistsInNotebook(notebookID, hpath string) bool {\n    files, _, err := model.ListDocTree(notebookID, hpath, 0, false, false, 128)\n    return err == nil && len(files) > 0\n}","tryCatchPattern":"if ! siyuan document move --id \"$DOC_ID\" --notebook \"$DEST_NB\" --hpath \"$HPATH\" 2>err.txt; then\n  grep -q 'human-readable path not found' err.txt && echo \"create parent folder in destination first: siyuan document create --notebook $DEST_NB --title <Parent>\" >&2\n  exit 1\nfi","preventionTips":["Always --dry-run move to resolve the destination path first.","Pre-create parent folders in the destination notebook before bulk moves.","Omit --hpath to move to the notebook root when unsure.","Keep hpath spelling/slashes consistent with the destination hierarchy."],"tags":["cli","cobra","document","notebook","hpath","path-resolution","data-lookup","go"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}