{"record":{"id":"bf318a3fc4901fbb","repo":"TheAlgorithms/Python","slug":"no-particles-provided","errorCode":null,"errorMessage":"No particles provided","messagePattern":"No particles provided","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"physics/center_of_mass.py","lineNumber":88,"sourceCode":"        ...\n    ValueError: Mass of all particles must be greater than 0\n\n    >>> center_of_mass([\n    ...     Particle(1, 2, 3, 0),\n    ...     Particle(5, 6, 7, 8),\n    ...     Particle(9, 10, 11, 12)\n    ... ])\n    Traceback (most recent call last):\n        ...\n    ValueError: Mass of all particles must be greater than 0\n\n    >>> center_of_mass([])\n    Traceback (most recent call last):\n        ...\n    ValueError: No particles provided\n    \"\"\"\n    if not particles:\n        raise ValueError(\"No particles provided\")\n\n    if any(particle.mass <= 0 for particle in particles):\n        raise ValueError(\"Mass of all particles must be greater than 0\")\n\n    total_mass = sum(particle.mass for particle in particles)\n\n    center_of_mass_x = round(\n        sum(particle.x * particle.mass for particle in particles) / total_mass, 2\n    )\n    center_of_mass_y = round(\n        sum(particle.y * particle.mass for particle in particles) / total_mass, 2\n    )\n    center_of_mass_z = round(\n        sum(particle.z * particle.mass for particle in particles) / total_mass, 2\n    )\n    return Coord3D(center_of_mass_x, center_of_mass_y, center_of_mass_z)\n\n","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/TheAlgorithms/Python/blob/f5988cc09713315817df6a7e327e258013a94440/physics/center_of_mass.py#L70-L106","documentation":"Error \"No particles provided\" thrown in TheAlgorithms/Python.","triggerScenarios":"Thrown at physics/center_of_mass.py:88 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide at least one particle."],"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-15T22:17:37.221Z"}