web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Error "'replace' expec...
Power Automate
Suggested Answer

Error "'replace' expects its first parameter 'string' to be a string."

(0) ShareShare
ReportReport
Posted on by 2
I'm sharing the solution to this problem because I couldn't find it anywhere.
 
 
So this is the error message. At first glance, it seems that the issue is with the `replace` function but of course it isn't.
 
The input to the `replace` function is the contents of a CSV file that is stored in OneDrive, which is retrieved using the Get_file_content_using_path action.
 
It turns out that one of the following has changed:
- the output from Get_file_content_using_path no longer returns a string, but an object, OR
- the conversion from the output of said action no longer automatically extracts the string value.
 
The solution is to add a Compose action to convert the output of Get_file_content_using_path to get its string contents.
 
The Compose action gets the contents of the output and unencodes the Base64 representation using this function:
base64ToString(body('Get_file_content_using_path')?['$content'])
That's it.
 
The solution was only obtained by checking the output of `actions('Get_file_content_using_path')`
 
What's frustrating about this error is that this flow that I had created in July 2025 had been working fine all along until 12 March 2026.
 
Something changed on this platform with no warning and the flow just failed.
Categories:
I have the same question (0)
  • Suggested answer
    Fredrik_A Profile Picture
    3,644 Super User 2026 Season 1 on at
    Hey,
     
    give this a try:
     
    base64ToString(outputs('Get_file_content_using_path')?['body']?['$content'])

    Otherwise add a Compose step and put the value below in it, and see what output you get. From there you can correctly add the dynamic value.
     
    base64ToString(body('Get_file_content_using_path')?['$content'])
     
  • CC-16030415-0 Profile Picture
    2 on at
    Oh great. After adding the Compose action to convert the object output of Get_file_content_using_path , and having the flow work for 1 day, now the flow breaks again because the output from Get_file_content_using_path  just switched back to a string. 
     
    So now the function in the Compose action
    base64ToString(body('Get_file_content_using_path')?['$content'])
    breaks because body('Get_file_content_using_path') just switched back to being a string again! What's happening?!
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 959

#2
Valantis Profile Picture

Valantis 872

#3
Haque Profile Picture

Haque 589

Last 30 days Overall leaderboard