{"record":{"id":"92e1c9988102bbdf","repo":"gastownhall/beads","slug":"cannot-use-both-pull-only-and-push-only","errorCode":null,"errorMessage":"cannot use both --pull-only and --push-only","messagePattern":"cannot use both --pull-only and --push-only","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/ado.go","lineNumber":507,"sourceCode":"\t}\n\tevt := metrics.NewCommandEvent(\"ado-sync\")\n\tdefer func() {\n\t\tif c := metrics.Global(); c != nil {\n\t\t\tc.CloseEventAndAdd(evt)\n\t\t}\n\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\")","sourceCodeStart":489,"sourceCodeEnd":525,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/ado.go#L489-L525","documentation":"`bd ado sync` rejects mutually exclusive direction flags: --pull-only (ADO→local) and --push-only (local→ADO) cannot both be given, since a sync cannot run both directions-only simultaneously. runADOSync checks this before any I/O and returns this plain error.","triggerScenarios":"Invoking `bd ado sync --pull-only --push-only`, e.g. in a script that appends both flags conditionally.","commonSituations":"Shell scripts building flags dynamically where both variables end up true; copy-pasting flag examples from docs; a wrapper alias accumulating flags.","solutions":["Remove one of the flags — run either `--pull-only` or `--push-only`.","Omit both flags for a full bidirectional sync.","In scripts, make the flags mutually exclusive (if/else) before exec'ing bd."],"exampleFix":"// before\nbd ado sync --pull-only --push-only\n\n// after\nbd ado sync --pull-only","handlingStrategy":"validation","validationCode":"if pullOnly && pushOnly {\n\treturn errors.New(\"--pull-only and --push-only are mutually exclusive\")\n}","typeGuard":null,"tryCatchPattern":"if err := bd(\"ado\", \"sync\", \"--pull-only\"); err != nil && strings.Contains(err.Error(), \"both --pull-only and --push-only\") {\n\t// fix the flag construction in the wrapper script\n}","preventionTips":["Build sync invocations with an if/else choosing one direction.","Encapsulate flag assembly in a single function that enforces exclusivity.","Avoid blindly concatenating extra flag variables in shell wrappers."],"tags":["cli","flags","argument-validation","azure-devops"],"backgroundTag":"conflicting-flags","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}