siyuan-note/siyuan · error
--av and --ids are required
Error message
--av and --ids are required
What it means
Thrown by `database remove` (item remove) when `--av` or `--ids` is empty. Removing rows requires the database ID and a comma-separated list of item IDs (row IDs) passed to `model.RemoveAttributeViewBlock`. Both are mandatory; the command then splits `--ids` on commas and trims each entry.
Source
Thrown at kernel/cli/cmd/database.go:288
srcs := []map[string]any{src}
if err := model.AddAttributeViewBlock(nil, srcs, avID, "", viewID, groupID, previousID, ignoreFill); err != nil {
return err
}
model.AppendPushReloadAttrViewEntry(avID)
fmt.Println("ok")
return nil
},
}
var databaseItemRemoveCmd = &cobra.Command{
Use: "remove --av <avID> --ids <id1,id2,...>",
Short: "Remove rows from database",
RunE: func(cmd *cobra.Command, args []string) error {
avID, _ := cmd.Flags().GetString("av")
idsStr, _ := cmd.Flags().GetString("ids")
if avID == "" || idsStr == "" {
return fmt.Errorf("--av and --ids are required")
}
ids := strings.Split(idsStr, ",")
for i := range ids {
ids[i] = strings.TrimSpace(ids[i])
}
if dryRun {
fmt.Printf("[dry-run] Would remove %d row(s) from database %s\n", len(ids), avID)
return nil
}
if err := model.RemoveAttributeViewBlock(ids, avID); err != nil {
return err
}
model.AppendPushReloadAttrViewEntry(avID)
fmt.Println("ok")
return nil
},View on GitHub (pinned to 251596fc0d)
Solutions
- List rows with `siyuan database render --av <id>` to obtain item IDs
- Pass both: `siyuan database remove --av <avID> --ids <itemID1>,<itemID2>`
- Use `--dry-run` to preview how many rows will be removed
Example fix
// before siyuan database remove --av 20240101000000-av12345 // after siyuan database remove --av 20240101000000-av12345 --ids 20240101000000-row1,20240101000000-row2
Defensive patterns
Strategy: validation
Validate before calling
if strings.TrimSpace(avID) == "" || strings.TrimSpace(idsStr) == "" {
log.Fatal("--av and --ids are required")
} Prevention
- Obtain item/row IDs from database render before removing
- Use --dry-run to confirm the count of rows targeted for deletion
When it happens
Trigger: Running `siyuan database remove --av <id>` without `--ids`, or omitting both.
Common situations: Not distinguishing item/row IDs from block IDs, or supplying a single ID where the command expects a comma list.
Related errors
- --av is required
- --av, --name and --type are required
- --av and --key are required
- --block is required for non-detached rows
- --av, --key, --item and --value are required
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/980d41efe04bc59e.
Report an issue: GitHub.