In Power Automate, an Invalid Reference error occurs when an expression attempts to use a reference that is incorrect, missing, or unavailable in the current context.
Error Message:
"Invalid reference – A reference used in an expression does not exist or is incorrect."
This issue can happen when:
- A variable, action, or dynamic content does not exist in the flow.
- The reference is misspelled or incorrectly formatted.
- A reference is used outside its valid scope (e.g., a loop variable used outside the loop).
- A reference is used before the related action has executed.
- A deleted or renamed action is still being referenced.
2. Common Causes of “Invalid Reference” Error
Cause | Description | Example |
---|---|---|
Missing Action or Variable | The referenced action or variable does not exist. | outputs('NonExistentAction') |
Misspelled or Incorrect Name | A reference has a typo or wrong name. | variables('myVar') instead of variables('MyVar') |
Reference Used Outside Its Scope | Attempting to access loop data outside the loop. | items('Apply_to_each')?['Title'] outside “Apply to Each” |
Deleted or Renamed Action | An action was renamed or removed, but still used elsewhere. | outputs('OldAction') after renaming it to NewAction |
Using Outputs Before Execution | Trying to access action data before the action runs. | outputs('Get_Items')?['value'] before “Get Items” has executed |
3. Step-by-Step Troubleshooting Guide
Step 1: Identify the Invalid Reference
- Open Power Automate (https://flow.microsoft.com).
- Navigate to My Flows and open the flow with the error.
- Go to Run History and find the failed execution.
- Expand the failed step and locate the expression causing the issue.
- Check if the referenced action, variable, or dynamic content exists and is spelled correctly.
Example Error Message:
"The template language function 'outputs' references an action 'Get_Items' that does not exist in the flow."
Step 2: Verify That the Reference Exists
If the reference points to an action that does not exist, confirm that:
✅ The action has not been deleted.
✅ The action name is spelled correctly.
✅ The action exists earlier in the flow before it is referenced.
Example Fix:
Incorrect:
outputs('Get_Items')?['value']
If Get_Items
does not exist, this will fail.
Correct:
- Check the action name in Power Automate UI and use the correct one:
outputs('GetItems')?['value']
(If the actual name is “GetItems”, not “Get_Items”)
Step 3: Check for Misspelled or Case-Sensitive References
Power Automate references are case-sensitive.
Solution: Ensure the reference matches exactly.
Example Fix:
Incorrect (wrong capitalization in variables()
):
variables('myVar')
Correct:
variables('MyVar')
Step 4: Ensure the Reference is Used in the Correct Scope
References inside loops, conditions, or scopes may not work outside of them.
Solution: Only reference loop variables within the loop.
Example Fix:
Incorrect (using items()
outside a loop):
items('Apply_to_each')?['Title']
This only works inside an “Apply to Each” loop.
Correct:
- Move the reference inside the loop.
- Use
first(body('Get_Items'))?['Title']
if you need only the first item.
Step 5: Fix Renamed or Deleted Actions
If an action was renamed or deleted, existing references to it will break.
Solution: Update all references after renaming an action.
Example Fix:
- Go to “Flow Checker” in Power Automate.
- Look for missing action errors.
- If an action was renamed from
Get_Items
toFetch_Items
, update all references:
Incorrect (old name):
outputs('Get_Items')?['value']
Correct (updated name):
outputs('Fetch_Items')?['value']
Step 6: Ensure Actions Execute Before They Are Referenced
If a reference depends on an action’s output, but the action hasn’t executed yet, Power Automate won’t recognize the reference.
Solution:
- Use “Configure Run After” to ensure the referenced action runs first.
- Place dependent actions inside the same scope.
Example Fix:
Incorrect (referencing output before execution):
outputs('Get_Items')?['value']
Correct (ensure Get_Items
runs before reference is used):
- Click on the dependent action.
- Go to “Configure Run After”.
- Select “Succeeded” for
Get_Items
.
Step 7: Test the Fixed Flow
Before finalizing the changes, test the corrected flow:
- Open Power Automate.
- Click Test → Manually trigger a test run.
- Check if the error is resolved.
If issues persist, return to Step 1 and recheck the reference names.