/debug
Starts or stops a debug profiling session, or runs a function with a full trace of every command it executes.
Overview
Starts or stops a debug profiling session, or runs a function with a full trace of every command it executes. In vanilla Minecraft Java Edition it is one of the special commands, first added in 1.3.1.
It is invoked as /debug <start|stop|function> [<function>] and accepts one required argument (<action>) and one optional argument ([function]).
The trace from /debug function marks executed commands with [C], returned messages with [M], failures with [E] and function calls with [F]. It is written to the debug folder of the game or server directory, not the world folder. /debug function cannot be called through /return run or from inside another /debug function.
A start/stop session gives back one number when it ends: the average ticks per second while it ran. /debug function is the part data pack authors use, because its trace file lists every command a function ran and what each one returned.
Syntax & Arguments
/debug <start|stop|function> [<function>]The full syntax is /debug <start|stop|function> [<function>]. Angle brackets < > mark required arguments and square brackets [ ] mark optional ones; a vertical bar | between words means you pick exactly one of those literals. You must always supply <action>. The argument [function] may be omitted, in which case the documented default applies.
- action
- Required, of type a literal. start = begin a profiling session; stop = end it and return the average ticks per second; function = run a function and write a trace file.
- function
- Optional, of type a resource. The function or function tag to trace (only for the function action).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| action | literal | Required | start = begin a profiling session; stop = end it and return the average ticks per second; function = run a function and write a trace file. |
| function | resource | Optional | The function or function tag to trace (only for the function action). |
Examples
The 3 examples below are ready to copy and adapt. For instance, /debug start starts a server profiling session. Each example varies the arguments to show a different real use of /debug; read the note under every snippet to see exactly what changes.
/debug startStarts a server profiling session.
/debug stopStops the session. The result is the average ticks per second measured while it ran.
/debug function my_pack:heavy_functionRuns the function and writes a debug-trace file to the debug folder, with a line for every command it ran.
Permission Level & Requirements
/debug sits at permission Level 3 - Admin, which means it needs permission level 3 (administrator).
Requires level 3.
This reference describes the Java Edition 1.21 form of the command; Bedrock Edition may use slightly different argument formats.
Common Mistakes
- Running /debug start without /debug stop, the profiling session continues until stopped, collecting data indefinitely.
- Expecting /debug stop to write a detailed report. For a full capture with entity and chunk lists, use /perf start on a dedicated server or F3+L in single player.
Notes
The trace from /debug function marks executed commands with [C], returned messages with [M], failures with [E] and function calls with [F]. It is written to the debug folder of the game or server directory, not the world folder. /debug function cannot be called through /return run or from inside another /debug function.
Related Commands
If /debug is part of your toolkit, the commands below are the ones you will most often reach for alongside it: /function and /tick. They cover closely related tasks, so the links above jump straight to each one.
Frequently Asked Questions about /debug
What does the /debug command do in Minecraft?
Starts or stops a debug profiling session, or runs a function with a full trace of every command it executes. It belongs to the special command group and was first added in Java Edition 1.3.1.
What is the correct syntax for /debug?
/debug <start|stop|function> [<function>]. The required argument is action, and the optional one is function.
What permission level does /debug need?
It requires permission Level 3 - Admin. On a server the player must be an operator at that level, or have cheats enabled in single-player.
What is a common mistake when using /debug?
Running /debug start without /debug stop, the profiling session continues until stopped, collecting data indefinitely.
Can you give an example of /debug in use?
Yes. /debug stop: stops the session. The result is the average ticks per second measured while it ran.
Need a Minecraft server?
Try these commands on Astroworld or host your own server.
Try Astroworld Hosting