{"record":{"id":"a8a21de559bccb9c","repo":"stablyai/orca","slug":"name-must-be-a-positive-number","errorCode":null,"errorMessage":"{name} must be a positive number","messagePattern":"(.+?) must be a positive number","errorType":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"native/computer-use-linux/runtime.py","lineNumber":816,"sourceCode":"        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\")\n    return str(value)\n\n\ndef click_at(x, y, button, count, modifiers=None):\n    button = (button or \"left\").lower()\n    buttons = {\"left\": (\"b1p\", \"b1r\"), \"right\": (\"b3p\", \"b3r\"), \"middle\": (\"b2p\", \"b2r\")}\n    if button not in buttons:\n        raise RuntimeError(f\"unsupported mouse button: {button}\")\n    parsed_count = require_positive_integer(1 if count is None else count, \"click_count\")\n    modifier_keys = click_modifier_keys(modifiers)","sourceCodeStart":798,"sourceCodeEnd":834,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/native/computer-use-linux/runtime.py#L798-L834","documentation":"Raised by require_positive_number at runtime.py:816 when float(value) raises TypeError or ValueError — i.e. the value is not parseable as a number at all (None where not defaulted, a non-numeric string, a dict/list). The sole call site passes name='pages' via scroll_at (runtime.py:895), which itself defaults None to 1, so this fires only for genuinely unparseable input.","triggerScenarios":"Calling the 'scroll' tool with operation['pages'] set to a non-numeric string ('few'), an empty string '', a list/dict, or another non-float-coercible type. NaN strings like 'NaN' parse to float without error and instead trip the isfinite check (error 502), not this one.","commonSituations":"A caller serializes pages from a loosely-typed JSON source and forwards 'lots' or an object; an LLM agent hallucinates a word instead of a number; a wrapper passes the wrong field type.","solutions":["Send pages as a number literal (int or float) in the operation JSON.","If pages is optional, omit the field rather than sending null/empty so the default of 1 applies.","Validate and coerce pages to float on the caller side before dispatching the scroll operation."],"exampleFix":"# before\n{\"tool\":\"scroll\",\"direction\":\"down\",\"pages\":\"few\"}\n# after\n{\"tool\":\"scroll\",\"direction\":\"down\",\"pages\":3}","handlingStrategy":"validation","validationCode":"def coerce_pages(raw):\n    if raw is None:\n        return 1\n    f = float(raw)  # raises TypeError/ValueError -> caller handles\n    return f\n\n# guard before dispatch\ntry:\n    pages = float(raw_pages)\nexcept (TypeError, ValueError):\n    pages = 1","typeGuard":"def is_parseable_number(value) -> bool:\n    try:\n        float(value)\n        return True\n    except (TypeError, ValueError):\n        return False","tryCatchPattern":"try:\n    run_operation(op)\nexcept RuntimeError as e:\n    if \"must be a positive number\" in str(e):\n        op[\"pages\"] = 1\n    else:\n        raise","preventionTips":["Send pages as a JSON number, not a string.","Omit pages to accept the default of 1.","Validate numeric coercion on the caller side before dispatch."],"tags":["validation","input-validation","computer-use","python"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}