NV4003Runtime

Key Not Found

An access operation on a map/dictionary requested a key that does not exist.

BREAKPOINT: main.nv:42rax = 0x7ffd9b82rbx = 0x00000001

Why this error occurs

Looking up an unpopulated key in a map without checking existence first.

Incorrect Code
let user = {"name": "Alice"}
let age = user["age"] // runtime error: key 'age' not found in map
Corrected Code
let user = {"name": "Alice"}
if "age" in user:
    print(user["age"])
else:
    print("Age not specified")

Troubleshooting & Remediation

  • 1Use 'key in map' membership check before subscript access.
  • 2Verify initial dictionary schema population.

Relevant CLI Commands

$ nextviper run <file.nv>