{"record":{"id":"cabc2f1364d3341c","repo":"calesthio/OpenMontage","slug":"name-value-r-is-not-supported-choose-one-of","errorCode":null,"errorMessage":"{name}={value!r} is not supported; choose one of {list(allowed)}","messagePattern":"(.+?)=(.+?) is not supported; choose one of (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/video/atlas_video.py","lineNumber":205,"sourceCode":"    def _resolve_model(self, model: str, operation: str, variant: str | None = None) -> str:\n        if model not in VIDEO_MODELS:\n            raise ValueError(\n                f\"Unsupported Atlas video model id {model!r}. Use get_info()['model_catalog'] for live routes.\"\n            )\n        spec = VIDEO_MODELS[model]\n        variant = variant or str(spec.get(\"variant\", \"standard\"))\n        route_key = operation if variant == \"standard\" else f\"{operation}_{variant}\"\n        resolved = VIDEO_ROUTES.get(spec[\"family\"], {}).get(route_key)\n        if not resolved:\n            raise ValueError(\n                f\"{spec['family']} does not expose operation={operation!r}, variant={variant!r} on Atlas Cloud\"\n            )\n        return resolved\n\n    @staticmethod\n    def _validate_choice(name: str, value: Any, allowed: tuple[Any, ...] | None) -> Any:\n        if allowed and value not in allowed:\n            raise ValueError(f\"{name}={value!r} is not supported; choose one of {list(allowed)}\")\n        return value\n\n    def _build_payload(self, inputs: dict[str, Any], model: str) -> dict[str, Any]:\n        spec = VIDEO_MODELS[model]\n        payload: dict[str, Any] = {\"model\": model, \"prompt\": inputs.get(\"prompt\", \"\")}\n\n        if spec[\"operation\"] != \"video_edit\":\n            duration = int(inputs.get(\"duration\", 10))\n            payload[\"duration\"] = self._validate_choice(\"duration\", duration, spec[\"durations\"])\n            ratio = inputs.get(\"aspect_ratio\", spec[\"default_ratio\"])\n            if ratio == \"16:9\" and spec[\"default_ratio\"] == \"adaptive\" and spec[\"ratios\"] == (\"adaptive\",):\n                ratio = \"adaptive\"\n            payload[spec[\"ratio_key\"]] = self._validate_choice(\"aspect_ratio\", ratio, spec[\"ratios\"])\n\n        resolution = inputs.get(\"resolution\", spec[\"default_resolution\"])\n        payload[\"resolution\"] = self._validate_choice(\"resolution\", resolution, spec[\"resolutions\"])\n\n        for field in spec.get(\"optional_fields\", ()):","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/video/atlas_video.py#L187-L223","documentation":"Raised by the static validator _validate_choice when a parameter restricted to a fixed tuple of allowed values (e.g. duration, aspect_ratio) receives a value outside it. Each model spec in VIDEO_MODELS defines allowed tuples; this guard enforces them before any network call.","triggerScenarios":"Passing duration=15 to a model whose spec['durations'] is (5,10); passing aspect_ratio='4:3' when spec['ratios'] only allows ('16:9','9:16') or ('adaptive',). Note the special case: ratio '16:9' is auto-remapped to 'adaptive' only when the spec's default_ratio is 'adaptive' and ratios == ('adaptive',).","commonSituations":"Copy-pasting parameters between models with different capability tuples; assuming a duration every model supports; string vs int mismatch for duration (it is int()-coerced first, so '10' is fine but 'ten' raises earlier); new model specs tightening allowed values.","solutions":["Read the error text: it lists the exact allowed values, e.g. duration=15 is not supported; choose one of [5, 10] — pick one of those","Call get_info() and inspect the model spec's durations/ratios tuples before building inputs","Parameterize your pipeline to read allowed values from the spec instead of hardcoding"],"exampleFix":"# before\ninputs = {'model':'bytedance/seedance-2.0','prompt':'...','duration':15}\n\n# after\ninputs = {'model':'bytedance/seedance-2.0','prompt':'...','duration':10}  # spec durations are (5, 10)","handlingStrategy":"validation","validationCode":"spec = atlas_video.get_info()['model_catalog'][model]\nduration = int(inputs.get('duration', 10))\nif spec['durations'] and duration not in spec['durations']:\n    inputs['duration'] = min(spec['durations'], key=lambda d: abs(d - duration))\nratio = inputs.get('aspect_ratio', spec['default_ratio'])\nif spec['ratios'] and ratio not in spec['ratios']:\n    inputs['aspect_ratio'] = spec['default_ratio']","typeGuard":"def valid_choices(spec: dict, duration: int, ratio: str) -> bool:\n    return ((not spec['durations'] or int(duration) in spec['durations']) and\n            (not spec['ratios'] or ratio in spec['ratios']))","tryCatchPattern":"try:\n    result = atlas_video.run(inputs=inputs)\nexcept ValueError as e:\n    if 'is not supported; choose one of' in str(e):\n        # message lists the allowed values; snap to one and retry once\n        allowed = ast.literal_eval(str(e).split('choose one of ')[1])\n        inputs['duration'] = allowed[0]  # or map the offending param by name\n        result = atlas_video.run(inputs=inputs)\n    else:\n        raise","preventionTips":["Read allowed tuples from the spec at pipeline build time, not from memory","Centralize parameter snapping (nearest duration, default ratio) in one helper","Log the model spec once per run so parameter mismatches are visible early"],"tags":["atlas-cloud","video-generation","validation","parameters"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}