Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-opus-4-20250514· AnthropicHugging Face LMArena Human Preference 140K

InvalidTemplate Unable to process template language expressions in action…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with DeepSeekdeepseek-v3-0324’s answer.
  1. User

    InvalidTemplate Unable to process template language expressions in action 'Gerar_Iniciais' inputs at line '0' and column '0': 'The template language expression 'if( empty(trim(variables('NomeRemetente'))), 'ZZ', concat( substring(first(split(trim(variables('NomeRemetente')), ' '))?[0], 0, 1), substring(last(split(trim(variables('NomeRemetente')), ' '))?[0], 0, 1) ) )' cannot be evaluated because property '0' cannot be selected. Property selection is not supported on values of type 'String'. Please see https://aka.ms/logicexpressions for usage details.'.

    this is in microsoft power automate.

  2. Claude Assistant

    This error occurs because you're trying to access array elements incorrectly in your Power Automate expression. The issue is with how you're using the ?[0] syntax.

    Here's the corrected expression:

    if(
        empty(trim(variables('NomeRemetente'))),
        'ZZ',
        concat(
            substring(first(split(trim(variables('NomeRemetente')), ' ')), 0, 1),
            substring(last(split(trim(variables('NomeRemetente')), ' ')), 0, 1)
        )
    )
    

    The key changes:

    • Removed ?[0] after first() and last() functions
    • first() and last() already return single string values from the array, not arrays themselves
    • You can't use array indexing on a string value, which was causing the error

    This expression will:

    1. Check if the name is empty or just whitespace
    2. If empty, return 'ZZ'
    3. If not empty, take the first letter of the first word and first letter of the last word to create initials

    For example:

    • "John Doe" → "JD"
    • "Mary Jane Smith" → "MS"
    • "" or " " → "ZZ"

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.