# Verify the flow

> Verify that the Price Watch Flow has been built correctly without any errors or warnings.

## Step 3 - Verify the flow

In the steps below, we will use the UiPath CLI (`uip`) to validate our flow, and cover some common warnings and errors it would pick up. This section teaches you how to use the CLI to look at how your Flow is configured, and validate it. Feel free to skip to the [Testing the Flow](maestro-flow-price-watch-test.md) section and come back later if you prefer that approach.

### 3.1 - Confirm the nodes and connections

Run the following command to list the nodes:

```bash
uip maestro flow node list PriceWatch/PriceWatch.flow --output table
```

The node list should hold exactly these six ids:

```text
Id              | Type                | Label
----------------|---------------------|-----------------
start           | core.trigger.manual | Manual trigger
fetchRate1      | core.action.http.v2 | Fetch rate
reshapeRate1    | core.action.script  | Reshape rate
belowThreshold1 | core.logic.decision | Below threshold
endAlert1       | core.control.end    | End alert
endNoAction1    | core.control.end    | End no action
```

Next, run the following command to check the connections (edges) between nodes:

```bash
uip maestro flow edge list PriceWatch/PriceWatch.flow --output table
```

The edge list should hold five edges, and **the Decision node must appear twice as a source**, once on its `true` port and once on `false`. A Decision node with one outgoing edge is the single most consequential structural defect in this flow, and the next section explains how to check for it.

```text
Id                                         | Source                | Target               
-------------------------------------------|-----------------------|----------------------
start-output-fetchRate1-input              | start:output          | fetchRate1:input     
fetchRate1-default-reshapeRate1-input      | fetchRate1:default    | reshapeRate1:input   
reshapeRate1-success-belowThreshold1-input | reshapeRate1:success  | belowThreshold1:input
belowThreshold1-true-endAlert1-input       | belowThreshold1:true  | endAlert1:input      
belowThreshold1-false-endNoAction1-input   | belowThreshold1:false | endNoAction1:input   
```

If your IDs differ, fix them now rather than adapting the expressions on the pages that follow. To change the IDs, follow the steps outlined for [how to rename a node ID](maestro-flow-price-watch-build.md#how-to-rename-a-node-id).

### 3.2 - Check for warnings and errors

The `validation` command reads the whole file, validates it, and it is a good habit to run it before you deploy a Flow to surface potential mistakes. Use the following command:

```bash
uip maestro flow validate PriceWatch/PriceWatch.flow
```

**Confirm that you see `"Status": "Valid"` with no `Warnings` fields** (the `File` field will contain the full, absolute path of the `.flow` file depending on your operating system and username):

```json
{
  "Result": "Success",
  "Code": "FlowValidate",
  "Data": {
    "File": "/home/user/tutorial-maestro-flow-price-watch/PriceWatch/PriceWatch.flow",
    "Status": "Valid"
  }
}
```

If you do not see any `Warnings`, feel free to skip to the next step to [Test the Flow](maestro-flow-price-watch-test.md).

:::tip
**Running the `validate` command before running the Flow is strongly recommended to avoid issues like the ones shown below.** Both `uip maestro flow debug` and `uip maestro flow publish` will complete successfully with warnings, and only fail if there were errors. If you are setting up Continuous Integration / Continuous Deployment (CI/CD) workflows, remember to add `uip maestro flow validate` before the `publish` command to ensure it does not publish or deploy a package that has warnings.
:::

### Common Warnings

Here are two common warnings types to keep an eye out for, and how to fix them:

1. **A missing `triggerNodeId`** on an input variable, which means it was set up as a global variable, not a trigger input variable. Global variables can be read and set by any node, and will not be shown when triggering the Flow manually as a required value to provide.

    ```text
    - [variables.globals[baseCurrency].triggerNodeId] Input variable "baseCurrency" is
      read via `$vars.start.output.baseCurrency`, but it has no "triggerNodeId". At
      runtime the trigger "start" output will not contain "baseCurrency", so the value
      resolves to null (a downstream node may fault, e.g. "Cannot read property '…' of
      null"). Set "triggerNodeId": "start" on the "baseCurrency" global.
    ```

    To fix this issue, first delete the global `baseCurrency` variable, and then edit the `start` trigger node to add the `baseCurrency` variable on that node (refer to [step 2.1](maestro-flow-price-watch-build.md#step-21---declare-the-trigger-inputs)).

2. **`MISSING_OUTPUT_MAPPING`** - an End node that does not set the output variable(s), and will return them with `null` values - any downstream system or Flow that needs them will likely error if the values are not set.

    ```text
    - [nodes[endAlert1].outputs.watchResult.source] [MISSING_OUTPUT_MAPPING] "End alert"
      is missing output mapping for "watchResult"
    ```

    To fix this issue, edit the `endAlert1` node and add the missing code to set the `watchResult` variable (refer to steps [2.5](maestro-flow-price-watch-build.md#step-25---add-the-alert-end-node) and [2.6](maestro-flow-price-watch-build.md#step-26---add-the-no-action-end-node)).

:::tip
**Each End node will have one field per output variable created in the Flow.** This ensures that all possible End nodes will return the same outputs, but how they are set is configured on each individual End node. A useful way to think about this is that the Trigger node's input variables and the End nodes' output variable are the contract values needed for this Flow, similar to request and response objects for an API call.
:::

If an output mapping is not set on an End node, it will be highlighted with a red warning for `"End" is missing output mapping for "<name>"` when viewing the node's properties in the canvas in VS Code. That is the same warning that `uip maestro flow validate` shows as `MISSING_OUTPUT_MAPPING`.

![Properties dialog of an End node where `watchResult` has not been set showing the error message from above](https://dev-assets.cms.uipath.com/assets/images/getting-started/maestro-flow-price-watch-missing-end-output-mapping-ef234f2a.png)

---

We can now [Test the Flow](maestro-flow-price-watch-test.md) using the Debug command.
