siyuan-note/siyuan · error
--id is required
Error message
--id is required
What it means
Returned by the `repo checkout` subcommand (rollback to a snapshot) when --id is empty. Rolling back the workspace requires a target snapshot identifier.
Source
Thrown at kernel/cli/cmd/repo.go:153
fmt.Printf("[dry-run] Would remove snapshot tag \"%s\"\n", name)
return nil
}
if err := model.RemoveTagSnapshot(name); err != nil {
return err
}
fmt.Println("ok")
return nil
},
}
var repoCheckoutCmd = &cobra.Command{
Use: "checkout --id <id>",
Short: "Checkout (rollback to) a snapshot",
RunE: func(cmd *cobra.Command, args []string) error {
id, _ := cmd.Flags().GetString("id")
if id == "" {
return fmt.Errorf("--id is required")
}
if dryRun {
fmt.Printf("[dry-run] Would rollback workspace to snapshot %s\n", id)
return nil
}
model.CheckoutRepoDirect(id)
model.AppendPushReloadFiletreeEntry()
model.AppendPushReloadUIEntry()
fmt.Println("ok")
return nil
},
}
var repoDiffCmd = &cobra.Command{
Use: "diff --left <id> --right <id>",
Short: "Diff two snapshots",View on GitHub (pinned to 251596fc0d)
Solutions
- Pass a valid snapshot ID: `repo checkout --id <snapshot-id>`.
- Use --dry-run to preview the rollback before committing to it.
- List snapshots first to obtain the correct ID.
Example fix
# before siyuan repo checkout # after siyuan repo checkout --dry-run --id 20240601-abc # then, once confirmed: siyuan repo checkout --id 20240601-abc
Defensive patterns
Strategy: validation
Validate before calling
[ -n "$SNAP_ID" ] || { echo 'repo checkout requires --id'; exit 1; }
# preview first
siyuan repo checkout --dry-run --id "$SNAP_ID"
# then roll back
siyuan repo checkout --id "$SNAP_ID" Type guard
n/a (CLI flag validation)
Try / catch
n/a (checkout is a destructive rollback; always dry-run first)
Prevention
- Checkout rolls the workspace back to a snapshot — always run with --dry-run first.
- Confirm the snapshot ID from the repo snapshot listing to avoid rolling back to the wrong point.
When it happens
Trigger: Running `repo checkout` with no --id flag or `--id ""`. The check fires before the dry-run and model.CheckoutRepoDirectDirect call.
Common situations: Omitting the flag, or a script that did not resolve the snapshot ID. Note checkout is a destructive rollback, so always confirm the snapshot ID.
Related errors
- --id and --name are required
- --name is required
- --left and --right are required
- --pattern is required
- --path is required
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/7031f20f1ed91cee.
Report an issue: GitHub.