docs/guides/troubleshooting.md
marimo understands the relationships between cells based on the variables they define and reference. When things don't work as expected, marimo provides several tools to help you understand both marimo's interpretation of your notebook and debug issues.
This guide covers common issues and unexpected behaviors you might encounter, along with ways to debug and resolve them. For interactive debugging techniques, see our debugging guide. If your issue isn't covered here, try checking our FAQ.
If you're expecting cells to run in response to changes in other cells, but they're not, consider the following:
marimo doesn't track mutations to objects. If you're modifying an object in one cell and expecting another cell to react, this won't work as expected.
Instead of mutating objects across cells, try creating new objects or performing all mutations within the same cell.
Use marimo's dataflow tools to check if your cells are actually connected as you expect.
Toggle the minimap to see the current cell's
connections. You should see connections to cells you expect as inputs on the
left and outgoing connections to other cells on the right. Here, the cell
defining f depends on the two cells above and connects to the one below with
print(f).
Alternatively, you can open the dependency graph or variables panel in the sidebar.
<div align="center"> <figure><figcaption>
Dependency graph showing cell connections.
</figcaption>
If connections are missing, review your variable usage to ensure cells are properly referencing each other.
If a cell is running more often than you anticipate:
Use marimo's dataflow tools to see what's triggering your cell:
Ensure you're not inadvertently using a global variables when intending to use a local variable or function argument:
_) for values that shouldn't be consumed by other cells.If a UI element's value keeps resetting:
If the cell defining the UI element reruns, it will reset the element's value to its initial value argument. You may be able to avoid this by splitting the UI element definition into a separate cell.
If you need to maintain UI element values across cell runs, consider using mo.state:
# Declare state in a separate cell
get_value, set_value = mo.state(initial_value)
element = mo.ui.slider(0, 10, value=get_value(), on_change=set_value)
This way, the value persists even if the cell defining the element reruns.
If you need to ensure a specific execution order:
Create an explicit dependency by using a variable from the first cell in the second:
# Cell 1
result = some_computation()
# Cell 2
_ = result # This creates a dependency on Cell 1
further_computation()
If you find yourself needing to force execution order often, it might be a sign that your notebook structure could be improved:
Before diving into manual debugging, try running marimo's built-in linter to catch common issues:
marimo check my_notebook.py
The linter can identify problems like:
See the Lint Rules guide for a complete list of checks.
mo.md() to output debug information in cell outputs.Remember, marimo's reactivity is based on global variable definitions and references, and mutations to objects aren't tracked. Keeping this in mind can help you understand and debug unexpected behaviors in your notebooks.
When using marimo edit path/to/notebook.py or marimo run path/to/notebook.py, marimo sets sys.path to match what you would get with
python path/to/notebook.py. In particular, setting sys.path[0] to the notebook
directory:
sys.path[0] == 'path/to/'
You can add entries to sys.path in your pyproject.toml runtime configuration.
When running as a notebook, marimo makes the following changes to variables:
pdb.Pdb with a custom class to enable interactive debugging
with the breakpoint() functionsys.argv when running as a notebook to match what you would
see when running as a script.If you're seeing 404 errors for web assets like JS or CSS files, it may be due to symlink settings or proxy settings.
If you are using bazel or uv's link-mode: symlink, you may need to adjust your symlink settings to ensure that web assets are correctly found. By default marimo does not follow symlinks, so you may need to turn this setting on.
Locate your marimo.toml configuration file with marimo config show, and edit the follow_symlink flag:
[server]
follow_symlink = true
If you are using a proxy server, you need to include the --proxy flag when running marimo. The proxy will default to port 80 if no port is specified. For example, if your proxy is example.com and it uses port 8080, you would run:
marimo edit --proxy example.com:8080
# or
marimo run --proxy example.com:8080
marimo will output logs to $XDG_CACHE_HOME/marimo/logs/*. To view the logs, run:
cat $XDG_CACHE_HOME/marimo/logs/github-copilot-lsp.log
Available logs are:
github-copilot-lsp.logpylsp.log