{"record":{"id":"83b9731e5eb0a936","repo":"siyuan-note/siyuan","slug":"notebook-is-required-83b973","errorCode":null,"errorMessage":"--notebook is required","messagePattern":"--notebook is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/inbox.go","lineNumber":129,"sourceCode":"\t\t\tif url != \"\" {\n\t\t\t\tfmt.Println(\"URL:    \", url)\n\t\t\t}\n\t\t\tfmt.Println(\"\\nMARKDOWN:\")\n\t\t\tfmt.Println(md)\n\t\t}\n\t\treturn nil\n\t},\n}\n\n// inboxConvertCmd 把一条或多条剪藏转为本地文档：取云端 md → 本地建文档 → 成功后清理云端原件。\n// 失败的条目不会被删除，也不会中断后续条目的处理；输出逐条结果。\nvar inboxConvertCmd = &cobra.Command{\n\tUse:   \"convert --ids <id1,id2,...> --notebook <id> [--path </h/path>] [--remove-after]\",\n\tShort: \"Convert cloud inbox shorthands into local documents\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tnotebook, _ := cmd.Flags().GetString(\"notebook\")\n\t\tif notebook == \"\" {\n\t\t\treturn fmt.Errorf(\"--notebook is required\")\n\t\t}\n\n\t\tidsRaw, _ := cmd.Flags().GetString(\"ids\")\n\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)","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/cli/cmd/inbox.go#L111-L147","documentation":"Thrown by the `inbox convert` subcommand when `--notebook` is empty. The notebook ID selects the destination for converting cloud shorthands into local documents. This is the first validation, ahead of `--ids` and the parent-path lookup.","triggerScenarios":"Running `siyuan inbox convert --ids 1,2,3` without `--notebook`. The RunE checks the notebook flag before parsing the `--ids` list.","commonSituations":"Omitting the destination notebook; using a notebook name instead of its ID; scripting convert without a target.","solutions":["List notebooks: `siyuan notebook list`","Pass both flags: `siyuan inbox convert --ids 1,2 --notebook <id>`"],"exampleFix":"// before\nsiyuan inbox convert --ids 1,2,3\n// after\nsiyuan inbox convert --ids 1,2,3 --notebook 20240101120000-abc","handlingStrategy":"validation","validationCode":"if notebook == \"\" {\n    out, _ := cmd.Output(\"siyuan\", \"notebook\", \"list\")\n    log.Fatalf(\"destination notebook ID required:\\n%s\", out)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Resolve the destination notebook ID first","Pass `--notebook` and `--ids` together for convert","Use the notebook ID, not its display name"],"tags":["cli","validation","missing-argument","inbox","notebook","go","siyuan"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}