Root Cause
A stack trace shows where a bug surfaced, not where it started. The real question points upstream: which caller passed the bad input, which recent change on the chain broke it, which service actually introduced the bad value before the others just passed it along.
Ask it. Watch the call.
Give the agent a ticket, the way you already do. It resolves the names on its own, and that is where it guesses. Switch Niro off and it works from the open files. Switch Niro on and you watch it call Niro, read the result, and answer from that.
Now ask it about your code
Paste this into the assistant you connected to Niro:
This is where it surfaced. Trace it back to where it started.