{"record":{"id":"db5320e76f0f7d8d","repo":"OpenBMB/ChatDev","slug":"timeout-seconds-must-be-a-positive-integer","errorCode":null,"errorMessage":"timeout_seconds must be a positive integer","messagePattern":"timeout_seconds must be a positive integer","errorType":"validation","errorClass":"ConfigError","httpStatus":null,"severity":"error","filePath":"entity/configs/node/python_runner.py","lineNumber":39,"sourceCode":"\n@dataclass\nclass PythonRunnerConfig(BaseConfig):\n    interpreter: str = field(default_factory=_default_interpreter)\n    args: List[str] = field(default_factory=list)\n    env: Dict[str, str] = field(default_factory=dict)\n    timeout_seconds: int = 60\n    encoding: str = \"utf-8\"\n\n    @classmethod\n    def from_dict(cls, data: Mapping[str, Any], *, path: str) -> \"PythonRunnerConfig\":\n        mapping = require_mapping(data, path)\n        interpreter = optional_str(mapping, \"interpreter\", path) or _default_interpreter()\n        args_raw = mapping.get(\"args\")\n        args = [str(item) for item in ensure_list(args_raw)] if args_raw is not None else []\n        env = optional_dict(mapping, \"env\", path) or {}\n        timeout_value = mapping.get(\"timeout_seconds\", 60)\n        if not isinstance(timeout_value, int) or timeout_value <= 0:\n            raise ConfigError(\"timeout_seconds must be a positive integer\", f\"{path}.timeout_seconds\")\n        encoding = optional_str(mapping, \"encoding\", path) or \"utf-8\"\n        if not encoding:\n            raise ConfigError(\"encoding cannot be empty\", f\"{path}.encoding\")\n        return cls(\n            interpreter=interpreter,\n            args=args,\n            env={str(key): str(value) for key, value in env.items()},\n            timeout_seconds=timeout_value,\n            encoding=encoding,\n            path=path,\n        )\n\n    FIELD_SPECS = {\n        \"interpreter\": ConfigFieldSpec(\n            name=\"interpreter\",\n            display_name=\"Python Path\",\n            type_hint=\"str\",\n            required=False,","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/OpenBMB/ChatDev/blob/4fb2db0ea90375ce1059f44fe03ffbd191a7a169/entity/configs/node/python_runner.py#L21-L57","documentation":"PythonRunnerConfig.from_dict validates that 'timeout_seconds' (default 60) is an int greater than zero. Floats, strings, bools with value <= 0 paths, zero, or negatives raise this ConfigError at path '<path>.timeout_seconds'.","triggerScenarios":"Setting timeout_seconds: 30.5, timeout_seconds: 0, or timeout_seconds: '60' in a python_runner node config.","commonSituations":"YAML floats from tuning (e.g. 0.5s granularity not supported); stringified values from env vars; setting 0 intending 'no timeout' — not allowed, pick a large int instead.","solutions":["Use a positive integer, e.g. 120","Wrap computed timeouts with int(...) ensuring > 0","For long runs set a large value rather than 0"],"exampleFix":"# before\ntimeout_seconds: 30.5\n# after\ntimeout_seconds: 30","handlingStrategy":"validation","validationCode":"t = cfg.get('timeout_seconds', 60)\nassert isinstance(t, int) and not isinstance(t, bool) and t > 0","typeGuard":"def is_valid_timeout(v) -> bool:\n    return isinstance(v, int) and not isinstance(v, bool) and v > 0","tryCatchPattern":"try:\n    PythonRunnerConfig.from_dict(d, path='config')\nexcept ConfigError as e:\n    if 'timeout_seconds' in str(e):\n        d['timeout_seconds'] = max(1, int(float(d['timeout_seconds'])))\n        PythonRunnerConfig.from_dict(d, path='config')","preventionTips":["int() cast timeouts from user input","Never use 0 for 'no timeout'; pick a large bound"],"tags":["config","python-runner","validation","timeout"],"backgroundTag":"invalid-config-value-type","analyzedSha":"4fb2db0ea90375ce1059f44fe03ffbd191a7a169","analyzedAt":"2026-08-27T14:35:29.622Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}