Treat corrupt-shape state files as missing in `load_state`

Open Beginner friendly
#175 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Qrytics is already working on this.

Since Nov 10, 2026.

  • #174 by @Qrytics — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli

Research direction

In overturemaps/state.py, read load_state and its current exception handling. Add tests for a JSON list state file and an unknown backend value, as described in the issue. Done means both invalid shapes return None without a traceback, and the docstring describes invalid state as well as missing files.

Written by the indexing model from the issue text.

Description

Context

A state file with valid JSON but the wrong shape (e.g. a top-level list, or an unknown backend value) makes overturemaps releases check crash with an unhandled AttributeError or ValueError traceback. Missing files, invalid JSON and missing keys already fall back to "no state"; wrong-shape files should do the same.

Proposed change

In state.py:

  • Extend the except clause in load_state to also catch AttributeError, TypeError and ValueError and return None.
  • Update the docstring to say None is returned for invalid state, not just missing files.
  • Add tests for a JSON list state file and an unknown backend value.
Dominant language
Python
Stars
280
Forks
48
Avg merge
4h 28m
Merged PRs (30d)
16

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OvertureMaps/overturemaps-py

All issues in OvertureMaps/overturemaps-py

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.