{"record":{"id":"f3d39efa23d570af","repo":"CoplayDev/unity-mcp","slug":"invalid-unity-mcp-timeout-value-timeout-raw-r","errorCode":null,"errorMessage":"Invalid UNITY_MCP_TIMEOUT value: {timeout_raw!r}","messagePattern":"Invalid UNITY_MCP_TIMEOUT value: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"Server/src/cli/utils/config.py","lineNumber":31,"sourceCode":"    port: int = 8080\n    timeout: int = 30\n    format: str = \"text\"  # text, json, table\n    unity_instance: Optional[str] = None\n\n    @classmethod\n    def from_env(cls) -> \"CLIConfig\":\n        port_raw = os.environ.get(\"UNITY_MCP_HTTP_PORT\", \"8080\")\n        try:\n            port = int(port_raw)\n        except (ValueError, TypeError):\n            raise ValueError(\n                f\"Invalid UNITY_MCP_HTTP_PORT value: {port_raw!r}\")\n\n        timeout_raw = os.environ.get(\"UNITY_MCP_TIMEOUT\", \"30\")\n        try:\n            timeout = int(timeout_raw)\n        except (ValueError, TypeError):\n            raise ValueError(\n                f\"Invalid UNITY_MCP_TIMEOUT value: {timeout_raw!r}\")\n\n        return cls(\n            host=os.environ.get(\"UNITY_MCP_HOST\", \"127.0.0.1\"),\n            port=port,\n            timeout=timeout,\n            format=os.environ.get(\"UNITY_MCP_FORMAT\", \"text\"),\n            unity_instance=os.environ.get(\"UNITY_MCP_INSTANCE\"),\n        )\n\n\n# Global config instance\n_config: Optional[CLIConfig] = None\n\n\ndef get_config() -> CLIConfig:\n    \"\"\"Get the current CLI configuration.\"\"\"\n    global _config","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/CoplayDev/unity-mcp/blob/c21bf496bca87d54e75bad048563c3adb1782081/Server/src/cli/utils/config.py#L13-L49","documentation":"Thrown by CLIConfig.from_env() when the UNITY_MCP_TIMEOUT environment variable cannot be parsed as an int (seconds). It defaults to '30' only when unset; a non-numeric value triggers this during startup, before any request is made.","triggerScenarios":"Setting UNITY_MCP_TIMEOUT to a non-integer such as '30s', 'fast', '' (empty), or '30.5'. Triggered on any CLI invocation that builds the config.","commonSituations":"A developer adds a unit suffix ('30s') expecting duration parsing, or a templated env value resolves to blank. Common when migrating from a tool that accepts duration strings.","solutions":["Set UNITY_MCP_TIMEOUT to an integer of seconds (e.g. 60).","Unset the variable to fall back to the 30s default: `unset UNITY_MCP_TIMEOUT`.","Check .env / CI variables for stray suffixes or empty values."],"exampleFix":"# before\nexport UNITY_MCP_TIMEOUT=30s\n# after\nexport UNITY_MCP_TIMEOUT=30","handlingStrategy":"validation","validationCode":"raw = os.environ.get(\"UNITY_MCP_TIMEOUT\", \"30\")\nif not raw.isdigit():\n    raise ValueError(f\"Invalid UNITY_MCP_TIMEOUT value: {raw!r}\")\ntimeout = int(raw)","typeGuard":"def is_int_env(raw: str | None) -> bool:\n    return raw is not None and raw.lstrip(\"+\").isdigit()","tryCatchPattern":"try:\n    cfg = CLIConfig.from_env()\nexcept ValueError as e:\n    print_error(str(e)); sys.exit(1)","preventionTips":["Set UNITY_MCP_TIMEOUT as integer seconds.","Do not append 's' or other units."],"tags":["cli","config","environment","validation"],"backgroundTag":null,"analyzedSha":"c21bf496bca87d54e75bad048563c3adb1782081","analyzedAt":"2026-08-13T17:36:56.095Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}