calesthio/OpenMontage · error · ValueError

task_action must be generate, create, query, or cancel

Error message

task_action must be generate, create, query, or cancel

What it means

Raised at the top of `execute()`: `task_action` (defaulting to 'generate') must be one of generate, create, query, or cancel. The tool multiplexes four operations on one entry point and dispatches on this string — anything else means the caller's intent is unknown, so the request is rejected before any validation or paid call. `dry_run` performs the same gate.

Source

Thrown at tools/video/seedance_ark.py:538

                            else "estimated"
                        ),
                    }
                )
            result["valid"] = True
        except (TypeError, ValueError, OSError) as exc:
            result["valid"] = False
            result["error"] = self._safe_error(exc)
        return result

    def execute(self, inputs: dict[str, Any]) -> ToolResult:
        """Create, query, cancel, or synchronously finish an Ark task."""
        started = time.time()
        action = str(inputs.get("task_action", "generate"))
        task_id: str | None = None
        estimated_cost_usd = 0.0
        try:
            if action not in {"generate", "create", "query", "cancel"}:
                raise ValueError(
                    "task_action must be generate, create, query, or cancel"
                )
            if action in {"query", "cancel"}:
                self._validate_task_id(inputs.get("task_id"))
            else:
                payload = self._build_payload(inputs)
                # Complete all local cost/config parsing before the paid POST.
                # A malformed exchange-rate override must never create an
                # untracked task and then fail while constructing ToolResult.
                estimated_cost_usd = self.estimate_cost(inputs)
        except (TypeError, ValueError, OSError) as exc:
            return ToolResult(success=False, error=self._safe_error(exc))

        api_key = self._get_api_key()
        if not api_key:
            return ToolResult(
                success=False,
                error="ARK_API_KEY not set. " + self.install_instructions,

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Use one of the four accepted values: 'generate' (alias of create), 'create', 'query', or 'cancel'
  2. Use lowercase — the comparison is case-sensitive
  3. For checking a task use `task_action: 'query'` with `task_id`; for aborting use 'cancel'

Example fix

# before
inputs = {"task_action": "status", "task_id": "csm18k..."}
# after
inputs = {"task_action": "query", "task_id": "csm18k..."}
Defensive patterns

Strategy: validation

Validate before calling

action = str(inputs.get("task_action", "generate")).lower()
if action not in {"generate", "create", "query", "cancel"}:
    raise ValueError(f"unsupported task_action {action!r}")

Type guard

def is_valid_action(a: object) -> bool:
    return str(a) in {"generate", "create", "query", "cancel"}

Prevention

When it happens

Trigger: Passing `task_action: "status"`, `"delete"`, `"poll"`, or a typo like `"creat"`; passing None explicitly (str(None)='none'); assuming another tool's action vocabulary applies here.

Common situations: Porting call code from a different provider tool whose actions are named differently; LLM-generated inputs guessing action names; casing mistakes like 'Generate' (str() is compared case-sensitively against the set).

Related errors


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/ac1737c086acf278. Report an issue: GitHub.