Hmbown/CodeWhale · error · anyhow::Error
workflow-tool requires --approval-source…
Error message
workflow-tool requires --approval-source explicit-workflow-command
What it means
The `workflow-tool` CLI command runs a Workflow tool spec directly, but only when invoked with an explicit approval source of `explicit-workflow-command`. This guard prevents arbitrary tool execution from being smuggled in under a non-workflow approval provenance.
Solutions
- Pass `--approval-source explicit-workflow-command` on the command line.
- If this call is not part of an explicit workflow, use the normal tool invocation path instead of workflow-tool.
- Fix wrapper scripts to hardcode the required approval-source constant.
Example fix
// before
codewhale workflow-tool --input-json '{...}'
// after
codewhale workflow-tool --approval-source explicit-workflow-command --input-json '{...}' Defensive patterns
Strategy: validation
Validate before calling
if [[ "$approval_source" != "explicit-workflow-command" ]]; then echo "refusing: workflow-tool requires --approval-source explicit-workflow-command" >&2; exit 2 fi
Try / catch
// shell if ! codewhale workflow-tool --approval-source explicit-workflow-command --input-json "$json"; then echo "workflow tool invocation rejected" >&2 fi
Prevention
- Hardcode the literal approval-source constant in wrapper scripts.
- Only reach for workflow-tool when executing an explicit workflow command.
- Keep this guard in mind when refactoring shared tool-invocation helpers.
When it happens
Trigger: Calling `codewhale workflow-tool ...` with `--approval-source` set to anything other than `"explicit-workflow-command"` (or omitted).
Common situations: Scripts wiring the workflow-tool command into generic tool pipelines that pass their own approval-source value, or forgetting the flag entirely.
Understand the failure class
Background: "unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools — this error's family across 24 libraries.
Related errors
- Codewhale account API base URL must not contain credentials
- `codewhale account` does not accept the global `--api-key`…
- Codewhale web is loopback-only and must bind to 127.0.0.1
- --input-json must be a JSON object
- Managing API keys needs an interactive login. Run…
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/d546c685e74c1a58.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/lib.rs:12224
Ok(()) => Ok(()),
Err(error) => {
let _ = emit_exec_stream_event(&ExecStreamEvent::Error {
error: format!("{error:#}"),
});
exit_workflow_tool_failure();
}
}
}
async fn run_workflow_tool_command_inner(
cli: &Cli,
args: WorkflowToolArgs,
plugin_registry: std::sync::Arc<crate::plugins::PluginRegistry>,
) -> Result<()> {
use crate::tools::spec::ToolSpec;
if args.approval_source != "explicit-workflow-command" {
bail!("workflow-tool requires --approval-source explicit-workflow-command");
}
let input: serde_json::Value = serde_json::from_str(&args.input_json)
.context("--input-json must be a valid Workflow tool input object")?;
if !input.is_object() {
bail!("--input-json must be a JSON object");
}
if !input
.get("action")
.and_then(serde_json::Value::as_str)
.is_some_and(|action| action.eq_ignore_ascii_case("run"))
{
bail!("workflow-tool accepts only action=run");
}
let workspace = resolve_workspace(cli);
let mut config = load_config_from_cli(cli)?;
merge_user_workspace_config(&mut config, cli.config.clone(), &workspace);
if let Ok(env_url) =View on GitHub (pinned to 73e0f67d83)