{"record":{"id":"1c5059192e7f6fc4","repo":"siyuan-note/siyuan","slug":"ids-is-required-comma-separated-shorthand-ids","errorCode":null,"errorMessage":"--ids is required (comma-separated shorthand IDs)","messagePattern":"--ids is required \\(comma-separated shorthand IDs\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/inbox.go","lineNumber":135,"sourceCode":"\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)\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\")","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/cli/cmd/inbox.go#L117-L153","documentation":"The `inbox convert` command parses the comma-separated `--ids` flag with parseShorthandIDs; if the resulting list is empty (flag unset, empty string, or only empty segments), the command rejects the invocation. At least one shorthand ID is required to know what to convert.","triggerScenarios":"Running `siyuan inbox convert --notebook <id>` with no `--ids`, or `--ids \"\"` / `--ids \",,\"` yielding an empty parsed list.","commonSituations":"Building the ID list programmatically from an empty query result; shell variable expansion producing an empty value; splitting/pasting IDs with wrong separators so nothing parses.","solutions":["Pass at least one shorthand ID: `--ids <id1>` or `--ids <id1,id2,...>` (comma-separated).","Verify the IDs exist in the cloud inbox before converting.","In scripts, guard: if [ -z \"$IDS\" ]; then echo \"no ids\"; exit 1; fi before calling the command."],"exampleFix":"// before\nsiyuan inbox convert --notebook 20240101120000-abcd123 --ids \"\"\n// after\nsiyuan inbox convert --notebook 20240101120000-abcd123 --ids abc123,def456","handlingStrategy":"validation","validationCode":"if [ -z \"$IDS\" ]; then echo \"--ids is required\"; exit 1; fi\nsiyuan inbox convert --ids \"$IDS\" --notebook \"$NOTEBOOK\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fetch shorthand IDs from the inbox API instead of hardcoding","Check the IDs list is non-empty before invoking convert","Use comma separators exactly as documented"],"tags":["cli","missing-flag","validation"],"backgroundTag":"missing-required-flag","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"}