{"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":"exception","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/58e5313667b857ef39a730e380af31816a7b1768/crates/but-agentlog/src/cli.rs#L443-L479","documentation":"resolve_publish_target in crates/but-agentlog/src/cli.rs validates the target kind for `but agentlog publish`. After the branch-shorthand path, only the literal kinds \"branch\", \"review\", or \"change\" are accepted; anything else bails with the unknown-publish-target message.","triggerScenarios":"Calling resolve_publish_target (via run_from_dir for `but agentlog publish <kind> <value>`) where <kind> is not branch/review/change, e.g. `but agentlog publish pr 123` or a misspelled kind like `brnch`.","commonSituations":"Misspelling the target kind, assuming other kinds like pr/tag are supported, or scripts parameterizing the kind with an unsupported value.","solutions":["Use an accepted kind: `but agentlog publish <branch>` or `but agentlog publish branch|review|change <value>`.","Map unsupported kinds (e.g. pr) to the closest supported one before invoking (pr -> review).","Validate the kind in your script against the fixed set {branch, review, change} before calling."],"exampleFix":"// before\nbut agentlog publish pr 123\n// after\nbut agentlog publish review 123","handlingStrategy":"validation","validationCode":"case \"$KIND\" in\n  branch|review|change) ;;\n  *) echo \"unsupported target kind: $KIND\"; exit 1 ;;\nesac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict kinds to branch/review/change (or use the bare `<branch>` shorthand).","Map external concepts (pr -> review) before invoking publish.","Whitelist the kind in scripts and quote values."],"tags":["rust","cli","invalid-enum-value","agentlog"],"backgroundTag":"invalid-enum-value","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}