{"record":{"id":"38b5b811a7c97827","repo":"siyuan-note/siyuan","slug":"notebook-is-required","errorCode":null,"errorMessage":"--notebook is required","messagePattern":"--notebook is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/dailynote.go","lineNumber":39,"sourceCode":"\n\t\"github.com/siyuan-note/siyuan/kernel/model\"\n\t\"github.com/siyuan-note/siyuan/kernel/util\"\n\n\t\"github.com/spf13/cobra\"\n)\n\nvar dailynoteCmd = &cobra.Command{\n\tUse:   \"dailynote\",\n\tShort: \"Daily note (dailynote) operations\",\n}\n\nvar dailynoteCreateCmd = &cobra.Command{\n\tUse:   \"create --notebook <id>\",\n\tShort: \"Create today's daily note\",\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\tif dryRun {\n\t\t\tfmt.Printf(\"[dry-run] Would create daily note in notebook %s\\n\", notebook)\n\t\t\treturn nil\n\t\t}\n\n\t\tp, _, err := model.CreateDailyNote(notebook)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tmodel.FlushTxQueue()\n\t\tmodel.AppendPushReloadFiletreeEntry()\n\n\t\tid := util.GetTreeID(p)\n\t\tfmt.Println(id)\n\t\treturn nil","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/cli/cmd/dailynote.go#L21-L57","documentation":"Thrown by `dailynote create` when the `--notebook` flag is empty. Daily notes are created inside a specific notebook via `model.CreateDailyNote`, which needs a notebook ID. The guard runs before dry-run and model interaction.","triggerScenarios":"Running `siyuan dailynote create` with no `--notebook`, or `--notebook \"\"`, or referencing an unset notebook ID variable.","commonSituations":"Not knowing the notebook ID (it is not the notebook name), or copying a command without substituting the placeholder.","solutions":["List notebooks first (`siyuan notebook list`) to obtain the notebook ID","Pass the ID: `siyuan dailynote create --notebook 20240101000000-nb12345`","Use `--dry-run` to validate flag wiring before the real call"],"exampleFix":"// before\nsiyuan dailynote create\n\n// after\nsiyuan dailynote create --notebook 20240101000000-nb12345","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(notebookID) == \"\" {\n    log.Fatal(\"--notebook is required\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Resolve the notebook ID via `siyuan notebook list` and store it","Pass the ID (not the notebook name) to the command"],"tags":["cli","dailynote","flag-validation","argument-required"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}