Noir provides two debugging interfaces:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/noir-lang/noir/llms.txt
Use this file to discover all available pages before exploring further.
- REPL debugger — a terminal-based interactive session launched with
nargo debug. - VS Code debugger — a graphical debugger via the vscode-noir extension, using the Debug Adapter Protocol (DAP).
REPL debugger
Starting the debugger
From your project directory, run:Prover.toml, and presents an interactive prompt:
main, use --test-name:
Command-line options
| Option | Description |
|---|---|
[WITNESS_NAME] | Write the execution witness to this file name when execution completes. |
-p, --prover-name <NAME> | Input TOML file name. Defaults to Prover. |
--package <NAME> | Package to debug. |
--test-name <NAME> | Name or substring of a test function to debug instead of main. |
--acir-mode | Compile to ACIR without debug instrumentation. Disables vars. |
--skip-instrumentation <BOOL> | Disable variable tracing instrumentation. |
--oracle-resolver <URL> | JSON-RPC URL for resolving oracle calls. |
REPL commands
Typehelp at the prompt to view all available commands:
Stepping commands
next (n) — step to the next source location
next (n) — step to the next source location
Advances execution to the next line in the Noir source code. If the current line calls a function, Using
next steps into that function.next at line 3 steps into deep_entry_point.over — step over function calls
over — step over function calls
Advances to the next source location without descending into called functions. Use this when you want to skip over a function call and continue at the next statement.Using
over at line 3 advances directly to line 4.out — step out of the current function
out — step out of the current function
Continues execution until the current function returns, then pauses at the call site.
step (s) — step to the next ACIR opcode
step (s) — step to the next ACIR opcode
Advances one ACIR opcode at a time. When paused at a
BRILLIG opcode (start of an unconstrained block), step skips the entire unconstrained block and moves to the next ACIR opcode. Use into to enter unconstrained blocks instead.into (i) — step into the next opcode (including unconstrained)
into (i) — step into the next opcode (including unconstrained)
Advances one opcode at a time, entering unconstrained (Brillig) blocks step by step.Using
into at the BRILLIG opcode pauses at opcode 1.0.continue (c) — run until breakpoint or end
continue (c) — run until breakpoint or end
Resumes execution, running until the next breakpoint is hit or the program finishes.
restart (res) — restart the session
restart (res) — restart the session
Interrupts the current debugging session and starts a new one from the beginning.
Breakpoints
Set a breakpoint at a specific opcode index:* marker in the opcode listing:
Inspecting variables
Usevars to display the current values of local variables at the current execution point:
Variable inspection requires debug instrumentation, which is enabled by default. If you pass
--acir-mode or --skip-instrumentation true, variable names will not be available and vars will return nothing.Witness map
Display the entire witness map:Stack trace
Unconstrained VM memory
These commands are only available while execution is inside an unconstrained (Brillig) block. Display memory:ACIR opcode listing
Display all ACIR opcodes for the compiled program:-> marker shows the current execution position.
Example session
VS Code debugger
The VS Code debugger provides a graphical debugging experience using the Debug Adapter Protocol.Setup
Install the VS Code extension
Install vscode-noir from the Visual Studio Marketplace.
Open your Noir project
Open the folder containing your
Nargo.toml directly as the VS Code workspace root. LSP features, including the debugger, require the workspace root to match the Noir project root.VS Code debugger features
Variable inspection: The Debug pane shows two sections — Locals (current program variables) and Witness Map (values fromProver.toml).
Stepping: Use the standard VS Code debugger toolbar buttons or keyboard shortcuts to step into, over, and out of functions.
Breakpoints: Click to the left of a line number to set a breakpoint. Press F5 (Continue) to run until the breakpoint is hit.
Hover values: Hover over a variable name in the source to see its current value.
Call stack: The Call Stack pane shows the active function call hierarchy.
DAP integration
The debugger uses the Debug Adapter Protocol via the hiddennargo dap subcommand, which is launched automatically by the VS Code extension. You do not need to invoke this command directly.