Invalid reference – A reference used in an expression does not exist or is incorrect

Loading

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

CauseDescriptionExample
Missing Action or VariableThe referenced action or variable does not exist.outputs('NonExistentAction')
Misspelled or Incorrect NameA reference has a typo or wrong name.variables('myVar') instead of variables('MyVar')
Reference Used Outside Its ScopeAttempting to access loop data outside the loop.items('Apply_to_each')?['Title'] outside “Apply to Each”
Deleted or Renamed ActionAn action was renamed or removed, but still used elsewhere.outputs('OldAction') after renaming it to NewAction
Using Outputs Before ExecutionTrying 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

  1. Open Power Automate (https://flow.microsoft.com).
  2. Navigate to My Flows and open the flow with the error.
  3. Go to Run History and find the failed execution.
  4. Expand the failed step and locate the expression causing the issue.
  5. 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:

  1. Move the reference inside the loop.
  2. 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:

  1. Go to “Flow Checker” in Power Automate.
  2. Look for missing action errors.
  3. If an action was renamed from Get_Items to Fetch_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):

  1. Click on the dependent action.
  2. Go to “Configure Run After”.
  3. Select “Succeeded” for Get_Items.

Step 7: Test the Fixed Flow

Before finalizing the changes, test the corrected flow:

  1. Open Power Automate.
  2. Click TestManually trigger a test run.
  3. Check if the error is resolved.

If issues persist, return to Step 1 and recheck the reference names.

Leave a Reply

Your email address will not be published. Required fields are marked *