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
In crates/but-agentlog/src/cli.rs run_from_dir, the Skim command bails with "target kind is required when target value is provided" when a value is given without a target kind. The match treats (None, Some(_)) as invalid; only both-or-neither are accepted.
Solutions
- Prefix the value with its target kind: `but agentlog skim session <value>` (or branch/change/review as applicable).
- Pass no filter arguments at all to skim everything, instead of a bare value.
- In wrappers/scripts, always emit both arguments together or neither.
Example fix
// before but agentlog skim abc123 // after but agentlog skim session abc123
Defensive patterns
Strategy: validation
Validate before calling
# require both or neither if [ -n "$VALUE" ] && [ -z "$TARGET" ]; then echo "provide a target kind"; exit 1; fi
Prevention
- Never pass a bare value to skim; always prefix with branch|session|review|change as supported.
- Keep target/value pairs together when constructing CLI args programmatically.
- Prefer no-arg skim when filtering intent is unclear.
When it happens
Trigger: Running `but agentlog skim <value>` where the value lands in the `value` positional while `target` is None — the (None, Some(_)) arm bails.
Common situations: Omitting the kind keyword, e.g. `but agentlog skim my-session` instead of `but agentlog skim session my-session`; script argument shifting that drops the kind.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- target value is required
- BUG: It should not be possible to omit sources
- unknown publish target
- Automatic CLI installation is not supported on Windows. To…
- Automatic CLI installation is only supported on macOS. See…
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/a2be1d649d82b375.
Report an issue: GitHub.
Appendix: 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 58e5313667)