How to Fix SharePoint Folder Rename Flow Errors in Power Automate
Question details
The user needs to resolve a flow failure in Power Automate that occurs when attempting to rename a SharePoint folder.

- Product
- Power Automate
- Device & OS
- not provided
- Scenario
- Running an automated flow to rename an existing folder within a SharePoint document library.
- Observed behavior
- The flow experiences long retries and fails with a BadGateway error because the Get Files action cannot locate the target folder, returning an empty result.
Ensure you have the correct SharePoint site address, document library name, and sufficient permissions to read and modify folder properties in the target library.
Verify Target Scope in the Get Files Action
Correcting the scope of your 'Get files (properties only)' action ensures the flow queries the parent library rather than an invalid or unavailable path.
A common cause of BadGateway errors during folder rename flows is that the 'Get files' action is trying to look inside a folder path that doesn't exist or is improperly referenced, causing it to return empty results and eventually time out.
Navigate to the Power Automate portal, go to 'My flows', and click 'Edit' on the flow that handles the SharePoint folder rename.
Find the 'Get files (properties only)' or 'Get folder metadata' action that precedes your rename step.
Check the 'Library Name' and 'Folder' fields. Ensure the action targets the parent Document Library instead of targeting a dynamic folder path that might be unavailable.
Click 'Save' at the top right, then use the 'Test' button to run the flow manually and verify if the action successfully retrieves the folder metadata.

Validate Folder Existence and Filter Query
Check that the filter query exactly matches an existing folder name in SharePoint to prevent empty outputs that break the flow.
Looking for a Lightweight Alternative for Document Management?
While Power Automate and SharePoint handle complex enterprise automation, you might just need a fast, reliable, and free solution for everyday document editing and management. Try WPS Office as your primary productivity suite.
- 1. Download the Installer: Visit the official WPS Office website and click the free download button for your operating system.
- 2. Install WPS Office: Run the downloaded installer and follow the on-screen instructions to complete the setup.
- 3. Open Your Documents: Launch WPS Office and directly open your existing DOCX, XLSX, and PPTX files with full formatting support.

Frequently Asked Questions
Why does my folder rename flow throw a BadGateway error?
A BadGateway error in this scenario usually means the flow timed out after multiple retries. This happens when the 'Get files' action is trying to read a folder path that doesn't exist, or the HTTP request is pointing to an invalid SharePoint location.
How do I correctly target a folder in the 'Get files' action?
You should point the 'Get files' action to the parent Document Library rather than the specific folder you intend to rename. Use a Filter Query to locate the specific folder by its name within that library.
What happens if the old folder name is missing in SharePoint?
If the old folder doesn't exist, the 'Get files' action will return an empty array. Since there is no Item ID to pass to the rename action, the flow cannot proceed and will fail if no error handling is in place.
Do I need to use an HTTP request to rename a SharePoint folder?
Yes, Power Automate does not have a native 'Rename Folder' action for SharePoint. You typically need to use the 'Send an HTTP request to SharePoint' action to patch the folder's metadata with the new name.




