{"record":{"id":"271c8bf0d5379376","repo":"siyuan-note/siyuan","slug":"id-and-name-are-required","errorCode":null,"errorMessage":"--id and --name are required","messagePattern":"--id and --name are required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/repo.go","lineNumber":109,"sourceCode":"\t\t}\n\n\t\tid, err := model.IndexRepo(memo)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Println(\"created snapshot\", id)\n\t\treturn nil\n\t},\n}\n\nvar repoTagCmd = &cobra.Command{\n\tUse:   \"tag --id <id> --name <name>\",\n\tShort: \"Tag a snapshot\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tid, _ := cmd.Flags().GetString(\"id\")\n\t\tname, _ := cmd.Flags().GetString(\"name\")\n\t\tif id == \"\" || name == \"\" {\n\t\t\treturn fmt.Errorf(\"--id and --name are required\")\n\t\t}\n\n\t\tif dryRun {\n\t\t\tfmt.Printf(\"[dry-run] Would tag snapshot %s with \\\"%s\\\"\\n\", id, name)\n\t\t\treturn nil\n\t\t}\n\n\t\tif err := model.TagSnapshot(id, name); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Println(\"ok\")\n\t\treturn nil\n\t},\n}\n\nvar repoUntagCmd = &cobra.Command{\n\tUse:   \"untag --name <name>\",\n\tShort: \"Remove a tag\",","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/cli/cmd/repo.go#L91-L127","documentation":"Returned by the `repo tag` subcommand when either --id (snapshot ID) or --name (tag label) is empty. Tagging a snapshot requires both a target and a label.","triggerScenarios":"Running `repo tag` missing one or both of --id / --name; the combined `id == \"\" || name == \"\"` check fires before model.TagSnapshot.","commonSituations":"Passing only the snapshot id, only the name, or a script that left one variable empty.","solutions":["Provide both flags: `repo tag --id <snapshot-id> --name <tag>`.","List snapshots first to obtain a valid snapshot ID."],"exampleFix":"# before\nsiyuan repo tag --id 20240601-abc\ngot: --id and --name are required\n# after\nsiyuan repo tag --id 20240601-abc --name release-1.0","handlingStrategy":"validation","validationCode":"[ -n \"$SNAP_ID\" ] && [ -n \"$TAG\" ] || { echo 'repo tag requires --id and --name'; exit 1; }\nsiyuan repo tag --id \"$SNAP_ID\" --name \"$TAG\"","typeGuard":"n/a (CLI flag validation)","tryCatchPattern":"n/a","preventionTips":["Tagging needs both a snapshot ID and a label; supply both in wrappers.","List snapshots to obtain a valid --id before tagging."],"tags":["cli","repo","validation","missing-argument"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}