UiPath Pitfall #4: A Variable With the Same Name as Your Argument
Description and use
Problem: an Out argument becomes Nothing after a Do block due to a variable with the same name. Fix: delete the duplicate variable, use Workflow Analyzer, and prefix arguments.
Problem
An Out argument receives a value, but after exiting a Do block it becomes Nothing because a variable with the same name shadows the argument.
Outcome
The Out argument retains its value after the Do block once the duplicate variable is removed and the workflow is analyzed.
Workflow
- Identify that an Out argument is unexpectedly Nothing after a Do block.
- Check the Variables panel for a variable named the same as the argument within the Do block.
- Delete the duplicate variable and keep the argument.
- Re-select the argument in the Assign activity.
- Run Workflow Analyzer to catch Variable Overrides Argument (ST‑NMG‑006).
- Set ST‑NMG‑006 to Error to surface the issue immediately.
- Use direction prefixes (in_, out_, io_) only for arguments to avoid confusion.
- Assign the Out argument once at the end of the workflow, using a local variable for intermediate calculations.
Evidence
Most of the time, a variable and an argument share a name.
If a variable and an argument have the same name, the variable is always the one used at runtime.
Ctrl + K in the To field of an Assign creates a new variable, not an argument.
Run Analyze File or Analyze Project from the Design ribbon. There are rules for exactly this: ST‑NMG‑006 Variable Overrides Argument.
- Record date: 2026-11-01T02:44:02.781Z