{"record":{"id":"fb7f73109133f82c","repo":"gastownhall/beads","slug":"w-prefer-local-prefer-ado-prefer-newer","errorCode":null,"errorMessage":"%w (--prefer-local, --prefer-ado, --prefer-newer)","messagePattern":"%w \\(--prefer-local, --prefer-ado, --prefer-newer\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/ado.go","lineNumber":513,"sourceCode":"\t}()\n\n\tcfg := getADOConfig()\n\tif err := validateADOConfig(cfg); err != nil {\n\t\treturn err\n\t}\n\n\tif !adoSyncDryRun {\n\t\tCheckReadonly(\"ado sync\")\n\t}\n\n\tif adoSyncPullOnly && adoSyncPushOnly {\n\t\treturn fmt.Errorf(\"cannot use both --pull-only and --push-only\")\n\t}\n\n\t// Validate conflict flags\n\tconflictStrategy, err := getADOConflictStrategy(adoPreferLocal, adoPreferADO, adoPreferNewer)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%w (--prefer-local, --prefer-ado, --prefer-newer)\", err)\n\t}\n\n\tif err := ensureStoreActive(); err != nil {\n\t\treturn fmt.Errorf(\"database not available: %w\", err)\n\t}\n\n\tout := cmd.OutOrStdout()\n\tctx := context.Background()\n\n\t// Create and initialize the ADO tracker\n\tat := &ado.Tracker{}\n\tcliProjects, _ := cmd.Flags().GetStringSlice(\"project\")\n\tif len(cliProjects) > 0 {\n\t\tat.SetProjects(tracker.DeduplicateStrings(cliProjects))\n\t}\n\tif err := at.Init(ctx, store); err != nil {\n\t\treturn fmt.Errorf(\"initializing Azure DevOps tracker: %w\", err)\n\t}","sourceCodeStart":495,"sourceCodeEnd":531,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/ado.go#L495-L531","documentation":"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.","triggerScenarios":"Running `bd ado sync` with two or more of --prefer-local, --prefer-ado, --prefer-newer set, e.g. `--prefer-local --prefer-newer`.","commonSituations":"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.","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."],"exampleFix":"// before\nbd ado sync --prefer-local --prefer-newer\n\n// after\nbd ado sync --prefer-local","handlingStrategy":"validation","validationCode":"n := 0\nfor _, b := range []bool{preferLocal, preferADO, preferNewer} {\n\tif b { n++ }\n}\nif n > 1 {\n\treturn errors.New(\"set at most one of --prefer-local/--prefer-ado/--prefer-newer\")\n}","typeGuard":null,"tryCatchPattern":"if err := bd(\"ado\", \"sync\", flags...); err != nil && strings.Contains(err.Error(), \"conflict resolution flags\") {\n\tlog.Printf(\"drop extra prefer flags: %v\", err)\n}","preventionTips":["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."],"tags":["cli","flags","argument-validation","conflict-resolution"],"backgroundTag":"conflicting-flags","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}