Skip to content

Commit a123a5f

Browse files
authored
fix(api): handle missing intermediate keys in poc index (#7029)
Sometimes, if you reset or mess with the index file, it will be valid enough to pass precondition checks but be missing the left or right intermediate keys and cause errors.
1 parent 9c07a34 commit a123a5f

File tree

1 file changed

+5
-1
lines changed
  • api/src/opentrons/calibration_storage

1 file changed

+5
-1
lines changed

api/src/opentrons/calibration_storage/delete.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,13 @@ def _remove_pipette_offset_from_index(pipette: str, mount: Mount):
120120
index_path = offset_dir / 'index.json'
121121
blob = io.read_cal_file(str(index_path))
122122

123-
if pipette in blob[mount.name.lower()]:
123+
try:
124124
blob[mount.name.lower()].remove(pipette)
125125
io.save_to_file(index_path, blob)
126+
except (KeyError, ValueError):
127+
# If the index file does not have a mount entry, you get
128+
# an error here
129+
pass
126130

127131

128132
def delete_pipette_offset_file(pipette: str, mount: Mount):

0 commit comments

Comments
 (0)