{"record":{"id":"52d8448e9fbc1259","repo":"calesthio/OpenMontage","slug":"ark-cny-per-usd-must-be-a-finite-number-greater-th","errorCode":null,"errorMessage":"ARK_CNY_PER_USD must be a finite number greater than 0","messagePattern":"ARK_CNY_PER_USD must be a finite number greater than 0","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/video/seedance_ark.py","lineNumber":452,"sourceCode":"            value = float(raw)\n        except (TypeError, ValueError) as exc:\n            raise ValueError(\n                \"custom_price_cny_per_million_tokens must be a finite \"\n                \"number greater than 0\"\n            ) from exc\n        if not math.isfinite(value) or value <= 0:\n            raise ValueError(\n                \"custom_price_cny_per_million_tokens must be a finite \"\n                \"number greater than 0\"\n            )\n        return value\n\n    @staticmethod\n    def _get_cny_per_usd() -> float:\n        try:\n            value = float(os.environ.get(\"ARK_CNY_PER_USD\", \"7.2\"))\n        except (TypeError, ValueError) as exc:\n            raise ValueError(\n                \"ARK_CNY_PER_USD must be a finite number greater than 0\"\n            ) from exc\n        if not math.isfinite(value) or value <= 0:\n            raise ValueError(\"ARK_CNY_PER_USD must be a finite number greater than 0\")\n        return value\n\n    def estimate_runtime(self, inputs: dict[str, Any]) -> float:\n        _, variant = self._resolve_model(inputs)\n        return 90.0 if variant in {\"fast\", \"mini\"} else 180.0\n\n    def dry_run(self, inputs: dict[str, Any]) -> dict[str, Any]:\n        \"\"\"Validate and estimate locally; never submit Ark's paid POST.\"\"\"\n        action = str(inputs.get(\"task_action\", \"generate\"))\n        result: dict[str, Any] = {\n            \"tool\": self.name,\n            \"task_action\": action,\n            \"status\": self.get_status().value,\n            \"would_execute\": False,","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/video/seedance_ark.py#L434-L470","documentation":"First branch of `_get_cny_per_usd()`: the `ARK_CNY_PER_USD` environment variable (exchange-rate override for converting CNY pricing to USD, default \"7.2\") could not be parsed as a float — TypeError/ValueError from `float(...)`. Typically this means the variable holds a non-numeric string such as \"7.2 CNY\", an empty-ish value, or embedded whitespace/symbols.","triggerScenarios":"Exporting `ARK_CNY_PER_USD=\"7.1元\"` or `\"~7.2\"`; a .env entry with stray characters or comments glued on; a value that is a bare hyphen or letters.","commonSituations":"Hand-edited .env files with units; copy-paste from a financial site including currency symbols or thousand separators; CI secrets store holding a malformed value.","solutions":["Set the variable to a plain decimal number: `ARK_CNY_PER_USD=7.2`","Unset it to fall back to the built-in default of 7.2","Check the .env line for trailing spaces, quotes, inline comments, or unit suffixes"],"exampleFix":"# before\nARK_CNY_PER_USD=\"7.2 CNY\"\n# after\nARK_CNY_PER_USD=7.2","handlingStrategy":"validation","validationCode":"import os\nraw = os.environ.get(\"ARK_CNY_PER_USD\", \"7.2\")\ntry:\n    rate = float(raw)\nexcept (TypeError, ValueError) as e:\n    raise ValueError(f\"ARK_CNY_PER_USD={raw!r} is not a number\") from e","typeGuard":"def env_rate_is_numeric() -> bool:\n    try:\n        float(os.environ.get(\"ARK_CNY_PER_USD\", \"7.2\"))\n        return True\n    except (TypeError, ValueError):\n        return False","tryCatchPattern":null,"preventionTips":["Keep env values unit-free plain decimals in .env","Add a startup config check for all ARK_* variables your deployment sets"],"tags":["seedance","ark","configuration","environment","exchange-rate"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}