gastownhall/beads · error

cannot use both --pull-only and --push-only

Error message

cannot use both --pull-only and --push-only

What it means

`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.

Source

Thrown at cmd/bd/ado.go:507

	}
	evt := metrics.NewCommandEvent("ado-sync")
	defer func() {
		if c := metrics.Global(); c != nil {
			c.CloseEventAndAdd(evt)
		}
	}()

	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")

View on GitHub (pinned to 71377f2769)

Solutions

  1. Remove one of the flags — run either `--pull-only` or `--push-only`.
  2. Omit both flags for a full bidirectional sync.
  3. In scripts, make the flags mutually exclusive (if/else) before exec'ing bd.

Example fix

// before
bd ado sync --pull-only --push-only

// after
bd ado sync --pull-only
Defensive patterns

Strategy: validation

Validate before calling

if pullOnly && pushOnly {
	return errors.New("--pull-only and --push-only are mutually exclusive")
}

Try / catch

if err := bd("ado", "sync", "--pull-only"); err != nil && strings.Contains(err.Error(), "both --pull-only and --push-only") {
	// fix the flag construction in the wrapper script
}

Prevention

When it happens

Trigger: Invoking `bd ado sync --pull-only --push-only`, e.g. in a script that appends both flags conditionally.

Common situations: Shell scripts building flags dynamically where both variables end up true; copy-pasting flag examples from docs; a wrapper alias accumulating flags.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/92e1c9988102bbdf. Report an issue: GitHub.