# uip maestro bpmn debug

> Upload a local Maestro BPMN project (or a single .bpmn file) to Studio Web and run a server-side debug session with streamed status updates using `uip maestro bpmn debug`.

`uip maestro bpmn debug` uploads a local Maestro project — or a single `.bpmn` file — to **Studio Web** and runs a server-side debug session, streaming per-element status updates back to the console and returning a final status. It's registered under the `bpmn` branch.

## Synopsis

```
uip maestro bpmn debug [project-path]
                  [--bpmn-file <path>]
                  [--folder-id <id>]
                  [--poll-interval <ms>]
                  [-i, --inputs <json>]
                  [--login-validity <minutes>]
```

Requires `uip login`. Honors [global options](./global-options.md). Exit codes follow the [standard contract](./exit-codes.md).

## Arguments

- `[project-path]` *(optional)* — path to the Maestro project directory. Must contain `project.uiproj`. Omit when using `--bpmn-file`. One of `<project-path>` or `--bpmn-file` is required; passing both is an error ("Provide either a project path or --bpmn-file, not both.").

## Options

| Option | Default | Description |
|---|---|---|
| `--bpmn-file <path>` | — | Debug a single `.bpmn` file directly instead of a project directory. Mutually exclusive with `<project-path>`. |
| `--folder-id <id>` | auto-detected | Orchestrator folder (`OrganizationUnitId`). If omitted, the folder on the current login session is used. Parsed and validated via `parseFolderId`. |
| `--poll-interval <ms>` | `2000` | Polling interval in milliseconds. Must be a positive number. |
| `-i, --inputs <json>` | — | Input arguments as JSON string, or `@path/to/file.json`. |
| `--login-validity <minutes>` | `10` | Minimum minutes before token expiration to trigger an automatic refresh. |

## Behavior

1. Validates login and pulls the organization, tenant, base URL, and auth token from the session.
2. Uploads the project to Studio Web under the target folder.
3. Polls for a final status, emitting per-element status lines like:
   ```
   Status: InProgress (2/5 elements completed)
     v Activity_1 [Completed]
     > Activity_2 [InProgress]
     - Activity_3 [NotStarted]
   ```
4. On incidents during the run, emits a log line.
5. Exits `0` if `finalStatus` is `Completed` or `Successful`; `1` otherwise.

## Examples

```bash
# Debug with auto-detected folder
uip maestro bpmn debug ./invoice-orchestration

# Specify folder and inline inputs
uip maestro bpmn debug ./invoice-orchestration --folder-id 2553016 \
  --inputs '{"amount":100,"customer":"Acme"}'

# Inputs from a file
uip maestro bpmn debug ./invoice-orchestration --inputs @inputs.json

# Debug a single .bpmn file directly, without a full project directory
uip maestro bpmn debug --bpmn-file ./main.bpmn
```

## Data shape (--output json)

```json
{
  "Code": "MaestroDebug",
  "Data": {
    "jobKey":      "b2c3d4e5-0000-0000-0000-000000000001",
    "instanceId":  "c3d4e5f6-0000-0000-0000-000000000001",
    "runId":       "d4e5f6a7-0000-0000-0000-000000000001",
    "finalStatus": "Completed",
    "solutionId":  "e5f6a7b8-0000-0000-0000-000000000001",
    "studioWebUrl": "https://cloud.uipath.com/org/studio_/designer/f6a7b8c9-...?solutionId=e5f6a7b8-...",
    "elementExecutions": [
      { "elementId": "Activity_1", "status": "Completed" }
    ]
  }
}
```

`studioWebUrl` links directly to the debug run in Studio Web.

## See also

- [`uip maestro bpmn process run`](./uip-maestro-bpmn-process.md#uip-maestro-bpmn-process-run) — run a *published* process
- [`uip maestro bpmn job traces`](./uip-maestro-bpmn-job.md#uip-maestro-bpmn-job-traces) — stream traces for an already-started job
- [Authentication](./authentication.md)
- [Maestro overview](./uip-maestro-bpmn.md)
