Problem Description:
I’m using the Custom Prompt feature in Power Automate to generate content via AI and insert the results into a Word template (.docx) that contains placeholders in the format {{FieldName}}
.
Flow steps:
- AI action (Custom Prompt) applies a prompt with an attached document and generates content.
- The next action attempts to build a Word document by replacing the
{{...}}
placeholders with the AI-generated content.
- The Word template is stored locally and contains placeholders such as
{{Verificacao}}
, {{Seletividade}}
, etc.
As soon as I place the template .docx file, and perform the tests, it works!! as shown in the image below, however when I try to save the prompt to use in my flow, the error below occurs.
Error Message:
{error: {code: "0x80048d0f",…}}
code: "0x80048d0f"
message: {"operationStatus":"Error","error":{"type":"Error","code":"DependencyFailure","message":"An error occurred while replacing output document placeholders.","properties":{"BackendErrorCode":"InternalServerError","DependencyHttpStatusCode":"500"}}}
Reproduction Scenario:
- Word template with placeholders:
{{InfoMaterial}}, {{Verificacao}}, {{Seletividade}}, {{Linearidade}}, {{Precisao}}, {{Exatidao}}, {{LimiteDeteccao}}, {{LimiteQuantificacao}}, {{Robustez}}, {{NaoConformidades}}, {{Classificacao}}, {{Corretivas}}
.
- When I run the action, it fails with status 500 and the error above.
What I’ve Checked/Tested:
- Confirmed that placeholders exist in the document and names are case-sensitive.
- Tested with simple placeholders (no accents, no spaces).
- Document is clean (no Track Changes, no comments).
- Placeholders are in a single run (not split by formatting).
Questions:
- Is this behavior expected?
- Does the action fail completely if any placeholder is missing from the JSON?
- Is there an official way to define default values (fallback) for missing placeholders?
- Is there documentation on limitations for the
{{...}}
replacement mechanism (e.g., supported characters, optional placeholders, null handling)?
Impact:
This error prevents document generation when the model does not return all fields (e.g., optional fields). I need to know:
- Do I always need to send all keys (even empty)?
- Or is there a configuration to ignore unfilled placeholders?
Attachments:
- Word template (.docx) with placeholders.
- Example Prompt.
- Recommended tags (e.g., Power Automate, AI Builder, Word Template, Custom Prompt)