gastownhall/beads · error
%w (--prefer-local, --prefer-ado, --prefer-newer)
Error message
%w (--prefer-local, --prefer-ado, --prefer-newer)
What it means
Wraps the error from getADOConflictStrategy when the --prefer-local, --prefer-ado, and/or --prefer-newer conflict-resolution flags of `bd ado sync` are mutually exclusive and more than one was supplied. The %w carries the underlying 'cannot use multiple conflict resolution flags' message and the suffix lists the offending flags.
Source
Thrown at cmd/bd/ado.go:513
}()
cfg := getADOConfig()
if err := validateADOConfig(cfg); err != nil {
return err
}
if !adoSyncDryRun {
CheckReadonly("ado sync")
}
if adoSyncPullOnly && adoSyncPushOnly {
return fmt.Errorf("cannot use both --pull-only and --push-only")
}
// Validate conflict flags
conflictStrategy, err := getADOConflictStrategy(adoPreferLocal, adoPreferADO, adoPreferNewer)
if err != nil {
return fmt.Errorf("%w (--prefer-local, --prefer-ado, --prefer-newer)", err)
}
if err := ensureStoreActive(); err != nil {
return fmt.Errorf("database not available: %w", err)
}
out := cmd.OutOrStdout()
ctx := context.Background()
// Create and initialize the ADO tracker
at := &ado.Tracker{}
cliProjects, _ := cmd.Flags().GetStringSlice("project")
if len(cliProjects) > 0 {
at.SetProjects(tracker.DeduplicateStrings(cliProjects))
}
if err := at.Init(ctx, store); err != nil {
return fmt.Errorf("initializing Azure DevOps tracker: %w", err)
}View on GitHub (pinned to 71377f2769)
Solutions
- Keep exactly one (or none — prefer-newer is the default) of the three flags.
- Audit wrapper scripts/aliases for a hard-coded prefer flag colliding with a user-supplied one.
- If you want 'newest wins', drop all three flags and rely on the default.
Example fix
// before bd ado sync --prefer-local --prefer-newer // after bd ado sync --prefer-local
Defensive patterns
Strategy: validation
Validate before calling
n := 0
for _, b := range []bool{preferLocal, preferADO, preferNewer} {
if b { n++ }
}
if n > 1 {
return errors.New("set at most one of --prefer-local/--prefer-ado/--prefer-newer")
} Try / catch
if err := bd("ado", "sync", flags...); err != nil && strings.Contains(err.Error(), "conflict resolution flags") {
log.Printf("drop extra prefer flags: %v", err)
} Prevention
- Rely on the default (prefer-newer) unless a specific strategy is required.
- In wrappers, let user flags override defaults instead of appending both.
- Document allowed combinations in the team runbook.
When it happens
Trigger: Running `bd ado sync` with two or more of --prefer-local, --prefer-ado, --prefer-newer set, e.g. `--prefer-local --prefer-newer`.
Common situations: Scripts merging per-repo defaults with user overrides (each sets a different prefer flag); aliases or Makefile targets appending their own flags; experimenting with conflict strategies without removing the previous flag.
Related errors
- cannot use both --pull-only and --push-only
- --strategy %s contradicts --%s
- cannot use multiple conflict resolution flags
- cannot specify both --reason-file and --reason/--resolution/
- a resolution strategy is required: --ours or --theirs
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/fb7f73109133f82c.
Report an issue: GitHub.