calesthio/OpenMontage · error · ValueError

model must be a non-empty Ark Model/Endpoint ID

Error message

model must be a non-empty Ark Model/Endpoint ID

What it means

Raised when the resolved model identifier is empty or contains whitespace. Resolution order is inputs['model'], then ARK_SEEDANCE_MODEL env var, then MODEL_IDS[variant]; an empty string, a 'default' placeholder that resolves to blank, or an endpoint ID with spaces/newlines all fail. Ark Model IDs and Endpoint IDs (e.g. 'ep-2024...') never contain whitespace.

Source

Thrown at tools/video/seedance_ark.py:919

                payload[key] = inputs[key]
        if inputs.get("web_search"):
            payload["tools"] = [{"type": "web_search"}]

        self._validate_optional_parameters(payload)
        self._validate_request_size(payload)
        return payload

    def _resolve_model(self, inputs: dict[str, Any]) -> tuple[str, str | None]:
        variant = str(inputs.get("model_variant", "standard")).lower()
        if variant not in self.MODEL_IDS:
            raise ValueError("model_variant must be 2.5, standard, fast, or mini")
        model = str(
            inputs.get("model")
            or os.environ.get("ARK_SEEDANCE_MODEL")
            or self.MODEL_IDS[variant]
        )
        if not model or any(char.isspace() for char in model):
            raise ValueError("model must be a non-empty Ark Model/Endpoint ID")
        for known_variant, known_model in self.MODEL_IDS.items():
            if model == known_model:
                return model, known_variant
        # Endpoint IDs and future model IDs can have account-specific pricing.
        # Keep the caller's requested model, but never pretend its price is the
        # public price of model_variant.
        return model, None

    @staticmethod
    def _normalize_duration(value: Any, max_seconds: int = 15) -> int:
        if value == "auto":
            return -1
        if isinstance(value, bool):
            raise ValueError(
                f"duration must be an integer from 4 to {max_seconds} or -1"
            )
        try:
            duration = int(value)

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Set model to the exact Ark Model ID or Endpoint ID with no surrounding spaces
  2. Strip the ARK_SEEDANCE_MODEL env value: export ARK_SEEDANCE_MODEL=$(echo "$ARK_SEEDANCE_MODEL" | tr -d '[:space:]')
  3. Omit model and model_variant-derived default is used

Example fix

# before: env contains "seedance-1.0-pro\n"
inputs = {"model": os.environ["ARK_SEEDANCE_MODEL"]}

# after
inputs = {"model": os.environ["ARK_SEEDANCE_MODEL"].strip()}  # or fix the env var
Defensive patterns

Strategy: validation

Validate before calling

model = str(inputs.get("model") or os.environ.get("ARK_SEEDANCE_MODEL") or "").strip()
assert model and not any(c.isspace() for c in model), "model ID has whitespace or is empty"

Type guard

def is_clean_model_id(model: str) -> bool:
    return bool(model) and not any(c.isspace() for c in model)

Prevention

When it happens

Trigger: model set to '' or ' ', an ARK_SEEDANCE_MODEL env var containing a trailing newline or spaces, or a model string copied with a line break in the middle.

Common situations: Env var set via a script that appends a newline; copy-pasting an endpoint ID across lines; secrets managers returning padded values.

Related errors


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