> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreflux.org/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Debug in LoT Notebooks

> Debug LoT and MQTT data with a Data Viewer and an Execution _Trace.

<Frame caption="Data Viewer: subscribe to topics and watch live MQTT data">
  <img src="https://mintcdn.com/coreflux/XSOUAWqOWS4Y2_FQ/images/extension/extension-data-viewer-basic.gif?s=7124718aa0d1a06105dd56a905f1a177" alt="Animated walkthrough of the LoT Data Viewer in VS Code: subscribing to topics and viewing live MQTT traffic" width="1920" height="1032" data-path="images/extension/extension-data-viewer-basic.gif" />
</Frame>

## Overview

Debugging in LoT Notebooks means confirming **data is moving on the right topics** and **your logic behaves as intended**. The extension includes a **Data Viewer** and an **Execution Trace** tied to each **LoT cell** so you can see data, replay flows and inspect every related **topic** and **variable**.

<Tip>
  Without the right view, you are mostly in the **dark** — you write code hoping nothing goes wrong. The **Data Viewer** and the **execution trace** light up the room, **showing what that code actually did**.
</Tip>

***

## Data Viewer

<Frame caption="Data Viewer: topic tree and replay viewer with live data and history replay">
  <img src="https://mintcdn.com/coreflux/XSOUAWqOWS4Y2_FQ/images/extension/extension-data-viewer-advanced.gif?s=68e85cdf93ebe2ce5c24a87b66d50544" alt="Animated walkthrough of the LoT extension Data Viewer: topic tree, message history, replay, and payload formatters" width="1280" height="688" data-path="images/extension/extension-data-viewer-advanced.gif" />
</Frame>

Inside **Coreflux Explorer**, the Data Viewer has two parts that work together:

### Topic Tree Viewer

<Frame caption="LoT MQTT Topic Tree Viewer, showing topic hierarchy and MQTT Payloads">
  <img src="https://mintcdn.com/coreflux/XSOUAWqOWS4Y2_FQ/images/extension/extension-data-viewer-topic-tree.png?fit=max&auto=format&n=XSOUAWqOWS4Y2_FQ&q=85&s=561af3decf708f1924c73ee7ce92a44a" alt="LoT MQTT Topic Tree Viewer, showing topic hierarchy and MQTT Payloads" width="331" height="257" data-path="images/extension/extension-data-viewer-topic-tree.png" />
</Frame>

The **topic tree** gives you a **quick glance** at your hierarchy and **live values** as messages arrive—handy for spotting whether a sensor topic or alert is updating, without needing to open a separate tool.

Use **Subscribe to All topics** when you want the tree to show all broker data, and **Subscribe to a topic** when you want to focus on specific information.

### Replay Data Viewer

<Frame caption="Data Viewer: data payload, topic tabs, timeline, and replay controls">
  <img src="https://mintcdn.com/coreflux/XSOUAWqOWS4Y2_FQ/images/extension/extension-data-viewer-json.png?fit=max&auto=format&n=XSOUAWqOWS4Y2_FQ&q=85&s=89cb011008958531b30e05dda02a2a14" alt="LoT Data Viewer showing JSON formatter with syntax highlighting, topic tab, message count, and timeline replay controls" width="790" height="609" data-path="images/extension/extension-data-viewer-json.png" />
</Frame>

**Click a topic in the tree** to open the **full Data Viewer** for that stream. There you get:

* **Message history** and a **multi-topic** layout so you can follow several related topics at once
* **Replay** controls to move through captured messages over time
* A **data formatter** so you can interpret payloads the way they were meant to be read—pick the view that matches how the payload is encoded

Use this when you need to inspect structure, compare payloads, or see the data history — not just see that “something changed” on a topic.

#### Adjust how you see the data

Choose a formatter after opening a topic. The full viewer supports **multiple topics**, a **message history**, **replay** (timeline and playback controls), and **data views** such as raw, JSON, Protobuf, geopoint, image, audio and PDF.

<Frame caption="Data Viewer Geopoint formatter: coordinates on a map">
  <img src="https://mintcdn.com/coreflux/XSOUAWqOWS4Y2_FQ/images/extension/extension-data-viewer-map.png?fit=max&auto=format&n=XSOUAWqOWS4Y2_FQ&q=85&s=ffd3ec12cd15adcb8f40aa465879ba10" alt="LoT Data Viewer Geopoint formatter showing geographic coordinates plotted on a map" width="701" height="865" data-path="images/extension/extension-data-viewer-map.png" />
</Frame>

***

## Execution trace

<Frame caption="Execution trace: topics and variables for the LoT cell, with timeline and replay">
  <img src="https://mintcdn.com/coreflux/XSOUAWqOWS4Y2_FQ/images/extension/extension-lot-trace.gif?s=117a51b175bb962e2f81c13cf341716d" alt="Animated walkthrough of the LoT extension execution trace showing cell-related topics and variables, timeline, and replay" width="1280" height="688" data-path="images/extension/extension-lot-trace.gif" />
</Frame>

The **execution trace** lets you **see every topic and variable** the cell touches—publishes, subscriptions, and related state—in one place, follow a **time-ordered history** of messages across them, and use **replay** with playback controls and a **timeline** to play, pause, and scrub the run. That way you can confirm execution order, timing, and which step produced which message when logic spans several topics.

It is scoped to the **LoT cell** you are debugging, so you stay with that cell’s footprint on the broker instead of hunting traffic across the whole system.

***

## Troubleshooting

When the viewer or trace does not match what you expect, open the sections below.

<AccordionGroup>
  <Accordion title="Broker connection issues">
    If cells fail immediately or never show a response, verify credentials and network first.

    1. Open the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P`) or use the connection control in the activity bar / status area as shown in your setup.
    2. Run **LoT Notebook: Change Credentials** and enter your broker URL, username, and password.
    3. Watch the status bar for a connected state before running cells.

    <Frame caption="Updating broker credentials in the LoT Notebooks extension">
      <img src="https://mintcdn.com/coreflux/XSOUAWqOWS4Y2_FQ/images/extension/extension-broker-connect.gif?s=faf63084741fb786ec1807145f691a89" alt="Animated walkthrough of entering broker credentials and connecting in VS Code" width="1280" height="688" data-path="images/extension/extension-broker-connect.gif" />
    </Frame>

    * Default credentials and TLS notes: [LoT Notebooks setup guide](/quick-start/vscode)
    * Confirm the broker is reachable (host, port, firewall, TLS if using `mqtts://`)
  </Accordion>

  <Accordion title="Cell run output and errors">
    When you click **Run** on a LoT cell, the extension sends the definition to the broker and shows the result directly below the cell.

    <Frame caption="Running a cell to deploy a LoT definition to the broker">
      <img src="https://mintcdn.com/coreflux/XSOUAWqOWS4Y2_FQ/images/extension/extension-deploy-basic-action.gif?s=d7edcd18dc774cad66ff4969543e29ae" alt="Animated walkthrough of clicking the Run button to deploy the action to the broker" width="1920" height="1032" data-path="images/extension/extension-deploy-basic-action.gif" />
    </Frame>

    | What you see                  | What it means                                                                                            |
    | ----------------------------- | -------------------------------------------------------------------------------------------------------- |
    | Success message / green check | The broker compiled and registered the entity (Action, Model, Route, or Rule).                           |
    | Error text                    | Often syntax, indentation, or broker-side validation—read the full message for line hints when provided. |
  </Accordion>
</AccordionGroup>

## Related guides

<CardGroup cols={2}>
  <Card title="How to Use a LoT Notebook" icon="code" href="/lot-notebooks/usage">
    Cell execution, commands, broker topics, and troubleshooting accordions.
  </Card>

  <Card title="Introduction to LoT" icon="sparkles" href="/lot-language/introduction">
    What LoT is, how it runs in the broker, and simple examples to build on.
  </Card>
</CardGroup>
