{"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/251596fc0de2f9528c00c224252fd073a99973f4/kernel/cli/cmd/inbox.go#L117-L153","documentation":"Thrown by the `inbox convert` subcommand when `--ids` is empty or yields no IDs after parsing. `parseShorthandIDs` splits the comma-separated value and trims empties; if nothing remains the command cannot convert anything. This check runs after the `--notebook` check.","triggerScenarios":"Passing `--ids \"\"`, `--ids \",,\"`, or omitting `--ids` entirely. `parseShorthandIDs` returns an empty slice and the length check trips the error.","commonSituations":"Pasting a malformed ID list with only commas; a variable that expanded to empty; forgetting the flag after `--notebook`.","solutions":["List inbox to get valid IDs: `siyuan inbox list`","Pass a clean comma-separated list: `siyuan inbox convert --ids 1,2 --notebook <id>`"],"exampleFix":"// before\nsiyuan inbox convert --notebook 20240101 --ids ,,\n// after\nsiyuan inbox convert --notebook 20240101 --ids 16890001,16890002","handlingStrategy":"validation","validationCode":"ids := strings.Split(idsRaw, \",\")\nvar clean []string\nfor _, s := range ids {\n    if t := strings.TrimSpace(s); t != \"\" { clean = append(clean, t) }\n}\nif len(clean) == 0 {\n    return errors.New(\"no valid shorthand IDs after parsing\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Trim and drop empty entries from the ID list before invoking","Run `inbox list` to copy valid IDs","Avoid trailing commas in the `--ids` value"],"tags":["cli","validation","missing-argument","inbox","go","siyuan"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}