gitbutlerapp/gitbutler · error

target kind is required when target value is provided

Error message

target kind is required when target value is provided

What it means

The mirror case of the missing-value error: but-agentlog skim received a target value without a target kind (Command::Skim { target: None, value: Some(_) }). The tool cannot tell whether the value names a branch, review, or change, so it bails instead of guessing.

Source

Thrown at crates/but-agentlog/src/cli.rs:361

                    let timeline = get_session_timeline_outline(
                        &repo_path,
                        &session_key,
                        status,
                        Some(limit.unwrap_or(DEFAULT_TIMELINE_LIMIT)),
                    )
                    .context("failed to read agent session timeline")?;
                    Ok(CommandOutput::Timeline(timeline))
                }
            }
        }
        Command::Skim { target, value } => {
            let explicit_target = match (target, value) {
                (Some(target), Some(value)) => Some((target, value)),
                (Some(target), None) => {
                    anyhow::bail!("{} target value is required", target.as_str())
                }
                (None, Some(_)) => {
                    anyhow::bail!("target kind is required when target value is provided")
                }
                (None, None) => None,
            };
            let repo_path = if explicit_target.is_some() {
                resolve_read_repo_path(dir)?
            } else {
                resolve_workdir(dir)?
            };
            let (target, value) = match explicit_target {
                Some(target) => target,
                None => skim::resolve_default_branch_target(&repo_path)?,
            };
            let target_key = related_session_target_key(target, &value);
            let sessions = find_related_sessions_limited_by_statuses(
                &repo_path,
                target.related_target(&target_key),
                None,
                &[PublicationStatus::LocalOnly, PublicationStatus::Published],

View on GitHub (pinned to 2497b8007a)

Solutions

  1. Add the target kind: but agentlog skim branch <name> (or review/change as appropriate).
  2. If you meant the default target, remove the value too so skim auto-detects the applied GitButler branch.
  3. Check `but agentlog skim --help` for the accepted argument shape.

Example fix

# before
but agentlog skim feat/auth
# after
but agentlog skim branch feat/auth
Defensive patterns

Strategy: validation

Validate before calling

fn skim_args_consistent(target: Option<TargetKind>, value: Option<&str>) -> bool {
    matches!((target, value), (None, None) | (Some(_), Some(_)))
}

Prevention

When it happens

Trigger: Running `but agentlog skim <value>` with only the value, or a wrapper passing a value flag without the kind — reaching the (None, Some(_)) match arm.

Common situations: Scripts forwarding a variable that is set for value but empty for kind; misordered arguments; users assuming the bare form is a branch name.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@2497b8007a (2026-08-17). Data as JSON: /api/errors/a2be1d649d82b375. Report an issue: GitHub.