gitbutlerapp/gitbutler · error

{} target value is required

Error message

{} target value is required

What it means

but-agentlog's skim subcommand takes a target kind (branch/review/change) plus a value. When a target kind is supplied without its value, argument parsing succeeds but run() rejects the half-specified pair with this bail, naming the kind whose value is missing (e.g. 'review target value is required').

Source

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

                None => {
                    let status = find_session_status(&repo_path, &session_key)?
                        .with_context(|| format!("agent session '{session_key}' was not found"))?;
                    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,

View on GitHub (pinned to 2497b8007a)

Solutions

  1. Supply the value for the given kind: but agentlog skim review <id> (or branch/change per --help).
  2. Or drop the kind entirely to let skim auto-discover the default branch target.
  3. Fix wrapper scripts so kind and value are always emitted as a pair.

Example fix

# before
but agentlog skim review
# after
but agentlog skim review 12345
Defensive patterns

Strategy: validation

Validate before calling

// Rust (clap): make the pair self-validating before run()
#[derive(clap::Args)]
struct SkimArgs {
    #[arg(requires = "value")]
    target: Option<TargetKind>,
    #[arg(requires = "target")]
    value: Option<String>,
}

Prevention

When it happens

Trigger: Running `but agentlog skim <kind>` with only the kind — Command::Skim { target: Some(t), value: None } — e.g. `but agentlog skim review` with no identifier after it.

Common situations: Shell completion or copy-pasted commands losing the trailing value; scripts building argv conditionally and omitting the value branch; values swallowed by quoting mistakes.

Related errors


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