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 / 131,072 character limi...
Power Automate
Suggested Answer

131,072 character limit on concat(), base64(), and string() functions - what's the truth?

(2) ShareShare
ReportReport
Posted on by 6
So - I've been working with both Google AI, and Copilot to figure out just where the reported `131,072` character limit for the `concat()`, `base64()`, and `string()` functions actually come into play.  I have successfully nested several replace() functions inside of a Compose action, which replaced a string: `'@string(variables(''fullBatchGetIDResponsesAsString''))'` with the actual variable.  The variable itself had `992,583` characters in it (yep - measured it via Notepad++).
 
The whole reason I'm even trying to figure this out is because I've been working on refactoring a flow to move all the variables into a single `Flow State` object variable with mutable properties so I can process all the different things that were taking up far too many actions for a single variable at once. . . . Then I learned today that there's this number.  Copilot not ONCE mentioned it as a potential issue, then I brought in Google's AI to help me understand something else around the logic of manipulating some of the data stream, and it flipped out about this `131,072` character limit, and I've now spent the better half of the last 3 hours freaking out and trying to understand exactly what this applies to.  If this will not work, I've just lost 5 weeks of work for nothing.
 
Has anyone ever gotten to the bottom of this?  The git pages show the last time this was updated on the blame table as over 3 years ago, and it's conflating at best.  The way the git page reads, it says:

| Expression evaluation limit | 131,072 characters | The `@concat()`, `@base64()`, and `@string()` expressions can't be longer than this limit. |
 
This says to me that the actual expression, as written in the editor window cannot be longer than this, but that conflates with the `8,192` expression limit that I've definitely hit before.
 
If the `131,072` character limit is really the longest the data inside the expression can be - then I have empirical evidence that shows this is not the case.

Any insights around this would really help.
Categories:
  • DB-20011720-0 Profile Picture
    6 on at
    I tried to edit the question to include the sanitized expression but it's not working for me, so I'll post it here.  The replacement was using a `concat()` function to do the work.
     
    if(
      equals(
        variables('scriptAttempt'),
        int('1')
      ),
      replace(
        replace(
          outputs('Compose_ScriptInputs_for_Full_MetadataUpdate_plus_verbiage'),
          ' (minus the massive JSON)',
          ''
        ),
        '@string(variables(''fullBatchGetIDResponsesAsString''))',
        concat(
          string(variables('fullBatchGetIDResponsesAsString')),
          variables('newLine'),
          'ATTEMPT_NUMBER: ',
          string(variables('scriptAttempt')),
          variables('newLine'),
          'SIASCRAPE_SCRIPT_STATUS: ',
          actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['status'],
          variables('newLine'),
          'ERROR_CODE: ',
          coalesce(
            actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['error']?['code'],
            actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['outputs']?['body']?['error']?['code'],
            actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['outputs']?['body']?['code'],
            'NO_ERROR_CODE_RETURNED'
          ),
          variables('newLine'),
          'ERROR_MESSAGE: ',
          coalesce(
            actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['error']?['message'],
            actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['outputs']?['body']?['error']?['message'],
            actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['outputs']?['body']?['message'],
            'NO_ERROR_MESSAGE_RETURNED'
          ),
          variables('newLine'),
          'SCRIPT_LOGS: ',
          coalesce(
            actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['logs'],
            actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['outputs']?['body']?['logs'],
            'NO_LOGS_RETURNED'
          )
        )
      ),
      concat(
        outputs('Compose_ScriptInputs_for_Full_MetadataUpdate_plus_verbiage'),
        variables('newLine'),
        'ATTEMPT_NUMBER: ',
        string(variables('scriptAttempt')),
        variables('newLine'),
        'SIASCRAPE_SCRIPT_STATUS: ',
        actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['status'],
        variables('newLine'),
        'ERROR_CODE: ',
        coalesce(
          actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['error']?['code'],
          actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['outputs']?['body']?['error']?['code'],
          actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['outputs']?['body']?['code'],
          'NO_ERROR_CODE_RETURNED'
        ),
        variables('newLine'),
        'ERROR_MESSAGE: ',
        coalesce(
          actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['error']?['message'],
          actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['outputs']?['body']?['error']?['message'],
          actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['outputs']?['body']?['message'],
          'NO_ERROR_MESSAGE_RETURNED'
        ),
        variables('newLine'),
        'SCRIPT_LOGS: ',
        coalesce(
          actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['logs'],
          actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['outputs']?['body']?['logs'],
          'NO_LOGS_RETURNED'
        )
      )
    )
     
  • Suggested answer
    Henil Profile Picture
    112 on at

    he 131,072-character limit refers to the evaluated result of certain expression functions, such as concat(), string() and base64(), rather than simply the number of characters written in the expression editor.

    In your expression, the main areas to watch are concat() and the conversion of fullBatchGetIDResponsesAsString using string().

    so you're working with potentially large JSON/data, the safer approach is to keep the data as an object/array for as long as possible, rather than converting the whole payload to one large string and concatenating additional content onto it.

    So the Flow State approach itself doesn't necessarily need to change, but I wouldn't design around being able to exceed Microsoft's documented expression limit consistently. Breaking large string operations into smaller steps would be safer for a production flow.

    Ref: https://learn.microsoft.com/en-us/power-automate/limits-and-config

    Hope this helps clarify the limit. Thanks!!

  • Suggested answer
    Haque Profile Picture
    4,278 Super User 2026 Season 2 on at
    Hi @DB-20011720-0,
     
    Thanks for providing the santized expressoins. I will walk in bit of a different way. Without looking at boundary hit of those functions, I will refactor the code and use a bit of modularization first:
     

    Compose action : Compose_ErrorCode

    coalesce(
      actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['error']?['code'],
      actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['outputs']?['body']?['error']?['code'],
      actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['outputs']?['body']?['code'],
      'NO_ERROR_CODE_RETURNED'
    )
    
    Compose action : Compose_ErrorMessage
    coalesce(
      actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['error']?['message'],
      actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['outputs']?['body']?['error']?['message'],
      actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['outputs']?['body']?['message'],
      'NO_ERROR_MESSAGE_RETURNED'
    )
    
    Compose action : Compose_Logs
    coalesce(
      actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['logs'],
      actions('Run_ExcelScript_to_get_UpdateMetadata_API_Data_set')?['outputs']?['body']?['logs'],
      'NO_LOGS_RETURNED'
    )
    
    Optimize Nested replace:
     
    //--Original code with nested replace funciton
    replace(
      replace(
        outputs('Compose_ScriptInputs_for_Full_MetadataUpdate_plus_verbiage'),
        ' (minus the massive JSON)',
        ''
      ),
      '@string(variables(''fullBatchGetIDResponsesAsString''))',
      concat(
        string(variables('fullBatchGetIDResponsesAsString')),
        ...
      )
    )
    
     
    //--Optimized replace with concat
    concat(
      replace(
        outputs('Compose_ScriptInputs_for_Full_MetadataUpdate_plus_verbiage'),
        ' (minus the massive JSON)',
        ''
      ),
      variables('newLine'),
      string(variables('fullBatchGetIDResponsesAsString')),
      ...
    )
    
     
    ORIGINAL CODE REFACTORED CODE.
     
     
     
     
     
     
     
     
    Please do bit of browse zoom in/out if screen is illegible.
     
    I will  discuss how the length of the string is almost half doing modular and avoding nested replace if this idea you like and works.
     
     

    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!
     
     
     
     

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 211 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 190

Last 30 days Overall leaderboard