Skip to content

500 Internal Server Error on status page when gpsd has no TPV data #550

Description

@TomEnde92

Description:

The web interface status page crashes with a 500 error when gpsd is running but has not yet received a valid TPV (position/time/velocity) fix from the GNSS receiver. This occurs when the receiver is initializing, after a device reset, or during satellite acquisition.
Steps to Reproduce:

Start/restart gpsd before F9P has acquired a 3D fix
Access the web interface status page: http://:5000/status
Observe 500 error

Expected Behavior:

The status page should load gracefully and display "Waiting for position fix" or similar message in the status section, allowing the user to monitor satellite acquisition in real-time.
Actual Behavior:

Flask throws IndexError: list index out of range and returns a 500 error.
Error Trace:
File "/home/rtkbase/rtkbase/web_app/server.py", line 432, in status_page
base_coordinates = {"lat" : base_position[0], "lon" : base_position[1]}
IndexError: list index out of range
Environment:

RTKBase v2.7.0 (Stefal)
Debian 13 (Trixie), Python 3.13
u-blox ZED-F9P receiver

Suggested Fix:

Add a null/empty check before accessing base_position:
pythonif base_position and len(base_position) >= 2:
base_coordinates = {"lat" : base_position[0], "lon" : base_position[1]}
else:
base_coordinates = {"lat" : 0.0, "lon" : 0.0} # or use a placeholder

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions