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 / Power Automate Flow Su...
Power Automate
Answered

Power Automate Flow Suddenly Failing with "Invalid File Name" for Dynamic OneDrive Filenames

(0) ShareShare
ReportReport
Posted on by 8

My Power Automate flow has been working for about two months with 150+ successful submissions using dynamic filenames in the format JP-yyyyMMdd-HHmmss. On 19 Jun 2026, it suddenly started failing in the OneDrive for Business Create File action with "Invalid file name", despite no changes to the flow, file naming logic, template, folder path, or licensing. The Compose and Word Template actions complete successfully, the generated JP number is valid, storage is available, and no duplicate files exist. A static filename such as test.docx works, but the dynamic filename that previously worked now fails. Has anyone experienced a recent issue with OneDrive Create File or dynamic filenames in Power Automate?
Screenshot 2026-06-20 050427.png
Screenshot 2026-06-20 050551.png
Categories:
I have the same question (0)
  • Suggested answer
    chiaraalina Profile Picture
    2,425 Super User 2026 Season 1 on at
    Hi
     
    Can you share the exact expression or dynamic content you are using in the OneDrive Create file -> File Name field?

    The post shows the intended format JP-yyyyMMdd-HHmmss, but we need to see the actual Power Automate expression, for example whether it is something like: concat('JP-', formatDateTime(utcNow(),'yyyyMMdd-HHmmss'), '.docx')
     
    Also, please share the Show raw inputs from the failed Create file action, especially the resolved name value.
     
    Thanks!
  • AA-20060055-0 Profile Picture
    8 on at
     
    Thank you for your response.
     
    I have attached screenshots of both the File Name configuration and the raw inputs from the failed Create File action.
     
    One thing I noticed is that the raw input contains:
     
    "name": "JP-20260622-131951\n.docx" (I dont know how to remove it if you suggest to do so)
     
    However, I also found successful runs from earlier that contain the same pattern with "\n", which makes me unsure whether it is the actual cause of the failure.
     
    Interestingly, static filenames such as "test.docx" and "JP-20260623.docx" work without a
    ny issues, while the dynamically generated filename fails.
     
    I would appreciate your thoughts after reviewing the screenshots.
     
    Thank you.
     
     
     
  • Verified answer
    Ellis Karim Profile Picture
    12,163 Super User 2026 Season 1 on at
    It seems that the file name P-20260622-131951\n.docx has a newline character (known as Line Feed) inserted, so it really looks like this:
     
    P-20260622-131951
    .docx
     
    The newline character (\n) can't be used in OneDrive filenames.
     
     
    You can use a replace function to remove this character:
    replace(
        variables('FileName'),
        decodeUriComponent('%0A'),
        ''
    )
     
    Character Name Encoded
    \n Line Feed (LF) %0A
    \r Carriage Return (CR) %0D
    \r\n Windows newline %0D%0A
     
    Ellis Karim
    Ellis Karim
    elliskarim.com  |  LinkedIn  |  Bluesky
    If this solved your issue, please mark it as ✅ Accepted Answer. If it helped, feel free to give it a 🩷 Like!
  • AA-20060055-0 Profile Picture
    8 on at

    Hi Ellis Karim,

    Thank you very much for your help and for taking the time to review my issue. Your suggestion was exactly what solved the problem. The filename contained hidden newline characters, and using the replace() function to remove %0A and %0D before passing the value to the OneDrive Create File action fixed the issue completely.

    Thank you again for your support

     

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard