Such errors can't be avoided. I need arrays for performance.
If performance is no concern I can use Maps, but I still need indexing ("partial functions") for architectural reasons: separation of concerns - can't make "safe" graphs where everything holds a reference to everything "related".
I just don't buy the idea that partial functions can be avoided.