{"record":{"id":"9ed5148b28c681f2","repo":"siyuan-note/siyuan","slug":"ids-is-required-9ed514","errorCode":null,"errorMessage":"--ids is required","messagePattern":"--ids is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/block.go","lineNumber":481,"sourceCode":"\t\t}\n\t\tif \"d\" == previousBt.Type {\n\t\t\treturn fmt.Errorf(\"document block [%s] cannot be used as a previous sibling; use it as --parent instead\", previousID)\n\t\t}\n\t\treturn nil\n\t}\n\tif err := treenode.CheckListItemNesting(parentID, id); err != nil {\n\t\treturn err\n\t}\n\treturn treenode.CheckContainerParent(parentID)\n}\n\nvar blockBatchGetCmd = &cobra.Command{\n\tUse:   \"batch-get --ids id1,id2,...\",\n\tShort: \"Batch get block info\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tidsStr, _ := cmd.Flags().GetString(\"ids\")\n\t\tif idsStr == \"\" {\n\t\t\treturn fmt.Errorf(\"--ids is required\")\n\t\t}\n\t\tids := splitIDs(idsStr)\n\t\tif len(ids) == 0 {\n\t\t\treturn fmt.Errorf(\"no valid IDs provided\")\n\t\t}\n\t\tinfos := model.GetDocsInfo(ids, false, false)\n\t\tswitch outputFormat {\n\t\tcase \"json\":\n\t\t\tdata, _ := json.MarshalIndent(infos, \"\", \"  \")\n\t\t\tfmt.Println(string(data))\n\t\tdefault:\n\t\t\tw := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)\n\t\t\tfmt.Fprintln(w, \"ID\\tNAME\\tROOTID\\tREFCOUNT\")\n\t\t\tfor _, info := range infos {\n\t\t\t\tfmt.Fprintf(w, \"%s\\t%s\\t%s\\t%d\\n\", info.ID, info.Name, info.RootID, info.RefCount)\n\t\t\t}\n\t\t\tfor _, id := range ids {\n\t\t\t\tfound := false","sourceCodeStart":463,"sourceCodeEnd":499,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/cli/cmd/block.go#L463-L499","documentation":"The `block batch-get` CLI command requires a comma-separated list of block IDs via the --ids flag. If the flag is absent or empty, RunE returns this error before doing any work (kernel/cli/cmd/block.go:481).","triggerScenarios":"Running `siyuan block batch-get` without --ids, with `--ids \"\"`, or with the flag name misspelled so GetString returns the empty default.","commonSituations":"Copy-pasting example commands and dropping the flag; shell variable expansion producing an empty string (`--ids \"$IDS\"` with unset IDS); assuming positional arguments work instead of the flag.","solutions":["Add the --ids flag with comma-separated block IDs, e.g. --ids 20240101120000-abc,20240101120000-def","If IDs come from a shell variable, verify it is non-empty before invoking the command","Check flag spelling (--ids, not --id or --block-ids)"],"exampleFix":"// before\nsiyuan block batch-get\n// after\nsiyuan block batch-get --ids 20240101120000-abc,20240101120000-def","handlingStrategy":"validation","validationCode":"if [ -z \"$IDS\" ]; then echo \"--ids is required\" >&2; exit 1; fi\nsiyuan block batch-get --ids \"$IDS\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --ids explicitly on the command line","Quote shell variables holding ID lists","Check command help (siyuan block batch-get --help) for required flags before scripting"],"tags":["cli","missing-flag","batch-get"],"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"}