I think you might be working into one of the "exceptions" domain where every little detail matters — perhaps made even worse by using non-strongly-typed langs like Python?
strong types make for great context for an LLM (so do docs, but.. those get out of date etfc.)