{"record":{"id":"03af9cd8c7766fc9","repo":"gitbutlerapp/gitbutler","slug":"unknown-publish-target-other-use-but-agentlo","errorCode":null,"errorMessage":"unknown publish target '{other}'. Use `but agentlog publish <branch>` or `but agentlog publish <branch|review|change> <value>`.","messagePattern":"unknown publish target '(.+?)'\\. Use `but agentlog publish <branch>` or `but agentlog publish <branch\\|review\\|change> <value>`\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-agentlog/src/cli.rs","lineNumber":461,"sourceCode":"            Ok(CommandOutput::Message {\n                message: \"Synced GitMeta metadata\".into(),\n            })\n        }\n    }\n}\n\nfn resolve_publish_target(\n    branch_or_target: String,\n    value: Option<String>,\n) -> anyhow::Result<(RelatedSessionTarget, String)> {\n    let Some(value) = value else {\n        return Ok((RelatedSessionTarget::Branch, branch_or_target));\n    };\n    match branch_or_target.as_str() {\n        \"branch\" => Ok((RelatedSessionTarget::Branch, value)),\n        \"review\" => Ok((RelatedSessionTarget::Review, value)),\n        \"change\" => Ok((RelatedSessionTarget::Change, value)),\n        other => anyhow::bail!(\n            \"unknown publish target '{other}'. Use `but agentlog publish <branch>` or `but agentlog publish <branch|review|change> <value>`.\"\n        ),\n    }\n}\n\nfn run_hook(dir: &Path, agent: Option<Agent>, input: &str) -> anyhow::Result<Option<PathBuf>> {\n    let input: HookInput =\n        serde_json::from_str(input).context(\"failed to parse agent hook input\")?;\n    let Some(transcript_path) = input\n        .transcript_path\n        .filter(|path| !path.as_os_str().is_empty())\n    else {\n        return Ok(None);\n    };\n    let dir = input\n        .cwd\n        .as_deref()\n        .filter(|path| !path.as_os_str().is_empty())","sourceCodeStart":443,"sourceCodeEnd":479,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/2497b8007aa4a1922dae9a805b32ffe5b5037785/crates/but-agentlog/src/cli.rs#L443-L479","documentation":"but agentlog publish takes either a bare branch name or a target-kind keyword plus value. resolve_publish_target inspects the first argument only when a second value is present and accepts just 'branch', 'review', and 'change'; anything else in the keyword slot produces this bail listing the accepted forms.","triggerScenarios":"Running `but agentlog publish <x> <y>` where <x> is not branch/review/change — e.g. `but agentlog publish pr 123`, a flag like --target in the keyword position, or a branch name accidentally followed by another value.","commonSituations":"Assuming a 'pr'/'pull-request' keyword exists; passing flag-style options where positional keywords are expected; copy-paste from older docs.","solutions":["Use a documented keyword: but agentlog publish branch <name>, but agentlog publish review <id>, or but agentlog publish change <id>.","To publish for the current branch, pass only the branch name: but agentlog publish <branch>.","Check `but agentlog publish --help` for the accepted forms before scripting."],"exampleFix":"# before\nbut agentlog publish pr 4521\n# after\nbut agentlog publish review 4521","handlingStrategy":"validation","validationCode":"const PUBLISH_KINDS: &[&str] = &[\"branch\", \"review\", \"change\"];\n\nfn valid_publish_invocation(first: &str, value: Option<&str>) -> bool {\n    match value {\n        None => true, // bare branch form\n        Some(_) => PUBLISH_KINDS.contains(&first),\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the keyword list in one place and reuse it for shell completion.","Validate argv before spawning `but agentlog publish` from scripts.","Use the bare-branch form when publishing for the current branch."],"tags":["cli","argument-validation","agentlog","publish"],"backgroundTag":"invalid-cli-argument","analyzedSha":"2497b8007aa4a1922dae9a805b32ffe5b5037785","analyzedAt":"2026-08-17T00:30:25.648Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}