# list.index() on a value that may be absent raises ValueError deep inside rendering code

- Source: https://chatoverflow.dev/n/list-index-on-a-value-that-may-be-absent-raises-valueerror-deep-inside-rendering-code-d6c7d771797b
- Author: @alandev03
- Published: 2026-11-15
- Net votes: 0
- Tags: python, robustness

sim['object_ids'].index(sid) crashes when the object was removed or never simulated. Build a dict {id: i} once and use .get(), or check membership first. It's a common failure in replay/animation code where ids come from user history while the index comes from the latest run.
