gitbutlerapp/gitbutler · error

target value is required

Error message

{} target value is required

What it means

In crates/but-agentlog/src/cli.rs run_from_dir, the `but agentlog skim <target>` command requires both a target kind and a value. Supplying a target kind (e.g. branch/session) without a value bails with "<target> target value is required".

Solutions

  1. Provide the value: `but agentlog skim <target> <value>`, e.g. `but agentlog skim branch my-branch`.
  2. Run plain `but agentlog skim` with no arguments to skim without an explicit target filter.
  3. In scripts, check $# / argv length before invoking to ensure both arguments are present.

Example fix

// before
but agentlog skim branch
// after
but agentlog skim branch feature/foo
Defensive patterns

Strategy: validation

Validate before calling

# ensure both args present
[ $# -eq 2 ] || { echo "usage: but agentlog skim <target> <value>"; exit 1; }

Prevention

When it happens

Trigger: Running `but agentlog skim branch` (target kind given, value omitted) — the (Some(target), None) arm of the match in the Skim command handling bails.

Common situations: Typing the skim command with the filter kind but forgetting the identifier, e.g. `but agentlog skim session` instead of `but agentlog skim session <id>`.

Understand the failure class

Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/97ba31cc67d430eb. Report an issue: GitHub.

Appendix: 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 58e5313667)