{"record":{"id":"9b3a9a2a3f9c07dc","repo":"Hmbown/CodeWhale","slug":"workflow-tool-accepts-only-action-run","errorCode":null,"errorMessage":"workflow-tool accepts only action=run","messagePattern":"workflow-tool accepts only action=run","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":12236,"sourceCode":"    args: WorkflowToolArgs,\n    plugin_registry: std::sync::Arc<crate::plugins::PluginRegistry>,\n) -> Result<()> {\n    use crate::tools::spec::ToolSpec;\n\n    if args.approval_source != \"explicit-workflow-command\" {\n        bail!(\"workflow-tool requires --approval-source explicit-workflow-command\");\n    }\n    let input: serde_json::Value = serde_json::from_str(&args.input_json)\n        .context(\"--input-json must be a valid Workflow tool input object\")?;\n    if !input.is_object() {\n        bail!(\"--input-json must be a JSON object\");\n    }\n    if !input\n        .get(\"action\")\n        .and_then(serde_json::Value::as_str)\n        .is_some_and(|action| action.eq_ignore_ascii_case(\"run\"))\n    {\n        bail!(\"workflow-tool accepts only action=run\");\n    }\n\n    let workspace = resolve_workspace(cli);\n    let mut config = load_config_from_cli(cli)?;\n    merge_user_workspace_config(&mut config, cli.config.clone(), &workspace);\n    if let Ok(env_url) =\n        std::env::var(\"CODEWHALE_BASE_URL\").or_else(|_| std::env::var(\"DEEPSEEK_BASE_URL\"))\n    {\n        let trimmed = env_url.trim();\n        if !trimmed.is_empty() {\n            config.base_url = Some(trimmed.to_string());\n        }\n    }\n\n    initialize_cloud_facts(&config);\n    let model = resolve_exec_model(&config, None);\n    let route = resolve_cli_exec_route(\n        &config,","sourceCodeStart":12218,"sourceCodeEnd":12254,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/lib.rs#L12218-L12254","documentation":"The workflow tool entry point only supports a single action, \"run\". If the tool input JSON does not carry action=\"run\" (compared case-insensitively), the handler bails out before resolving the workspace or loading config, because any other action is not a recognized workflow operation.","triggerScenarios":"Calling the workflow tool with input missing the \"action\" key, with action set to a value other than \"run\" (e.g. \"list\", \"status\", \"RUN \" with stray whitespace will still pass due to eq_ignore_ascii_case, but \"Run workflow\" will not), or with action as a non-string JSON value (number, object).","commonSituations":"Hand-written tool-call JSON from an agent guessing an action name; a wrapper or script automating workflow invocations with a stale or invented action verb; JSON serialization producing a non-string action field.","solutions":["Set the tool input to {\"action\": \"run\", ...} exactly, with action as a JSON string","Remove any wrapper whitespace/newlines around the action value","If another action was intended, check whether the workflow tool exposes it at all — it does not; only run exists","Validate the JSON payload before dispatch to confirm action is a string equal to run"],"exampleFix":"// before\n{\"action\": \"execute\", \"workflow\": \"deploy\"}\n// after\n{\"action\": \"run\", \"workflow\": \"deploy\"}","handlingStrategy":"validation","validationCode":"const input = JSON.parse(toolCall.arguments);\nif (typeof input.action !== \"string\" || input.action.toLowerCase() !== \"run\") {\n  throw new Error(`workflow-tool requires action=\"run\", got ${JSON.stringify(input.action)}`);\n}","typeGuard":"const isRunAction = (v: unknown): v is { action: string } & Record<string, unknown> =>\n  typeof v === \"object\" && v !== null &&\n  typeof (v as any).action === \"string\" &&\n  (v as any).action.toLowerCase() === \"run\";","tryCatchPattern":null,"preventionTips":["Keep a typed client wrapper that hardcodes action:\"run\"","Never let an LLM free-form the action field; constrain it via tool schema enum","Add a schema enum [\"run\"] for the action field in tool definitions"],"tags":["cli","tool-input","validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}