{"record":{"id":"17468cc9f016c763","repo":"stablyai/orca","slug":"name-must-be-a-positive-integer","errorCode":null,"errorMessage":"{name} must be a positive integer","messagePattern":"(.+?) must be a positive integer","errorType":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"warning","filePath":"native/computer-use-linux/runtime.py","lineNumber":806,"sourceCode":"    return bool(index is not None and attempt(lambda: node.do_action(int(index)), False))\n\n\ndef screen_point(window_rect, saved_element=None, x=None, y=None, node=None):\n    rect = screen_rect(node) if node is not None else None\n    if rect is not None:\n        return rect.x + rect.width / 2, rect.y + rect.height / 2\n    if saved_element is not None:\n        raise RuntimeError(\"stale element frame; run get-app-state again and use a fresh element index\")\n    if window_rect is None or x is None or y is None:\n        raise RuntimeError(\"coordinate action requires a visible window and coordinates\")\n    return window_rect.x + float(x), window_rect.y + float(y)\n\n\ndef require_positive_integer(value, name):\n    try:\n        parsed = int(value)\n    except (TypeError, ValueError):\n        raise RuntimeError(f\"{name} must be a positive integer\")\n    if parsed <= 0:\n        raise RuntimeError(f\"{name} must be a positive integer\")\n    return parsed\n\n\ndef require_positive_number(value, name):\n    try:\n        parsed = float(value)\n    except (TypeError, ValueError):\n        raise RuntimeError(f\"{name} must be a positive number\")\n    if not math.isfinite(parsed) or parsed <= 0:\n        raise RuntimeError(f\"{name} must be a positive number\")\n    return parsed\n\n\ndef require_non_empty_string(value, name):\n    if value is None or str(value) == \"\":\n        raise RuntimeError(f\"{name} is required\")","sourceCodeStart":788,"sourceCodeEnd":824,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/native/computer-use-linux/runtime.py#L788-L824","documentation":"Raised by require_positive_integer (runtime.py:802-809) when a value cannot be parsed as a strictly-positive integer: int(value) raises (TypeError for None/non-numeric objects, ValueError for non-numeric strings) OR parsed ≤ 0. The {name} placeholder identifies which parameter failed — at call sites, 'click_count' (line 1067/833) is the primary caller. Note that 0 and negative integers fail even though they parse, and floats like '1.5' fail (int('1.5') raises ValueError).","triggerScenarios":"operation.get('click_count') is non-null and either non-numeric (string 'abc', null-cast, object), a float string ('1.5'), or ≤ 0 (0, -1, '0'). Also any future caller of require_positive_integer passing a defaulted/missing field that resolves to None or 0. The check at line 1067-1069 only runs require_positive_integer when click_count is not None, so omitting it entirely is safe (defaults to 1).","commonSituations":"Agent passed click_count:0 (perhaps meaning 'no click, just hover' — unsupported) or a fractional/negative value; a templated caller defaulted click_count to 0 or a string; JSON deserialization produced a float where an int was expected.","solutions":["Omit click_count entirely to accept the default of 1, OR pass a positive integer ≥ 1.","If the intent was a single click, pass click_count:1 explicitly rather than relying on edge values.","Validate click_count is a positive integer on the caller side before dispatching the operation JSON.","For drag/scroll helpers, ensure 'pages' (validated via require_positive_number, which allows floats) is distinguished from click_count (integers only)."],"exampleFix":"// before — invalid click counts\n{ \"tool\": \"click\", \"click_count\": 0 }   // <= 0\n{ \"tool\": \"click\", \"click_count\": \"2\" } // string ok if numeric, but '1.5' fails\n{ \"tool\": \"click\", \"click_count\": -1 } // negative\n\n// after — positive integer or omitted\n{ \"tool\": \"click\", \"click_count\": 2 }\n{ \"tool\": \"click\" } // defaults to 1","handlingStrategy":"validation","validationCode":"# Validate click_count before dispatch\nimport numbers\ndef is_positive_int(value) -> bool:\n    return isinstance(value, int) and not isinstance(value, bool) and value > 0\n# usage:\nif 'click_count' in operation and operation['click_count'] is not None:\n    if not is_positive_int(operation['click_count']):\n        raise SystemExit(f'click_count must be a positive integer, got {operation[\"click_count\"]!r}')","typeGuard":"def is_valid_positive_integer(value, name: str) -> bool:\n    try:\n        parsed = int(value)\n    except (TypeError, ValueError):\n        return False\n    return parsed > 0","tryCatchPattern":"try:\n    run_operation(operation)\nexcept RuntimeError as exc:\n    if 'must be a positive integer' in str(exc):\n        # coerce or default: drop click_count to accept default of 1\n        operation = {k: v for k, v in operation.items() if k != 'click_count'}\n        operation.setdefault('click_count', 1)\n        run_operation(operation)\n    else:\n        raise","preventionTips":["Omit click_count entirely to accept the default of 1, OR pass a positive integer ≥ 1.","Validate click_count is a positive integer (not float, not string, not ≤ 0) on the caller side.","Distinguish 'pages' (require_positive_number, allows floats) from 'click_count' (integers only)."],"tags":["linux","at-spi","validation","input","integer","click"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}