{"record":{"id":"698b5ef884de33f0","repo":"TheAlgorithms/Python","slug":"mass-cannot-be-less-than-0","errorCode":null,"errorMessage":"Mass cannot be less than 0","messagePattern":"Mass cannot be less than 0","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"physics/basic_orbital_capture.py","lineNumber":53,"sourceCode":"    Traceback (most recent call last):\n        ...\n    ValueError: Radius cannot be less than 0\n    >>> capture_radii(6.957e8, -1.99e30, 25000.0)\n    Traceback (most recent call last):\n        ...\n    ValueError: Mass cannot be less than 0\n    >>> capture_radii(6.957e8, 1.99e30, c+1)\n    Traceback (most recent call last):\n        ...\n    ValueError: Cannot go beyond speed of light\n\n    Returned SI units:\n    ------------------\n    meters | m\n    \"\"\"\n\n    if target_body_mass < 0:\n        raise ValueError(\"Mass cannot be less than 0\")\n    if target_body_radius < 0:\n        raise ValueError(\"Radius cannot be less than 0\")\n    if projectile_velocity > c:\n        raise ValueError(\"Cannot go beyond speed of light\")\n\n    escape_velocity_squared = (2 * G * target_body_mass) / target_body_radius\n    capture_radius = target_body_radius * sqrt(\n        1 + escape_velocity_squared / pow(projectile_velocity, 2)\n    )\n    return round(capture_radius, 0)\n\n\ndef capture_area(capture_radius: float) -> float:\n    \"\"\"\n    Input Param:\n    ------------\n    capture_radius: The radius of orbital capture and impact for a central body of\n    mass M and a projectile moving towards it with velocity v","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/TheAlgorithms/Python/blob/f5988cc09713315817df6a7e327e258013a94440/physics/basic_orbital_capture.py#L35-L71","documentation":"Error \"Mass cannot be less than 0\" thrown in TheAlgorithms/Python.","triggerScenarios":"Thrown at physics/basic_orbital_capture.py:53 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a mass of 0 or greater."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f5988cc09713315817df6a7e327e258013a94440","analyzedAt":"2026-08-14T17:30:07.041Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}