Copilot Studio Friction

Get notified when this record changes

One email when the status or the fix changes — double opt-in, no tracking, unsubscribe in every email.

"A JSON could not be generated. Edit your prompt instruction…"

Mitigatedsince 8 July 2026

Last verified

Details & related

Assessment

Confidence
Confirmed officialConfirmed by Microsoft documentation or an official statement.
Severity
Blocking
Typical time lost
Hours

Identification

LLM steps

Verification & changes

  1. Verified

    Doc check by human: Official JSON output and prompt performance pages re-read during seed migration; error text, metadata-wrapping cause and slim-structure guidance still documented.

  2. Change

    Provisionally approved by the Product Owner; external LLM quality review pending.

  3. Change

    Initial record created from the seed dossier (migration wave 1).

Are you in the right place?

  • You built a prompt tool with its output set to "JSON".
  • Testing it fails with A JSON could not be generated. Edit your prompt instruction and try again. in the prompt builder.
  • The same prompt works when the output is set to "Text".
  • The error returns no matter how often you retry.

If instead the JSON works but never reflects your later edits → see the format-freeze record (record planned). If instead users see raw JSON in the chat → see Chat shows raw JSON instead of an answer. If instead the prompt output can't be selected in your topic → see the disabled-output record (record planned).

What's happening

Copilot Studio does not enforce your JSON structure as a strict schema. It infers the format from your example, then checks each response against it. The error appears when the model wraps its JSON in extra text or metadata. The platform then cannot verify the requested format and gives up. Think of a form scanner: it rejects the page when someone scribbles notes in the margins. Two things raise the failure odds: vague instructions that invite commentary, and complex structures with many keys. Official guidance says unnecessary structure also increases cost and latency (documented as of 2026-07-08). So the same cleanup that fixes the error makes the prompt cheaper and faster.

For technicians

The official JSON output documentation names this error and its cause: model output wrapped with metadata prevents format verification. There is no response_format-style schema constraint; the format is example-based inference. Once you edit the JSON example manually, the format becomes "Custom" and freezes. It then never updates from later tests; the generated JSON schema is viewable but not editable (documented as of 2026-07-08).

How to fix it

Solution 1

Official workaround

Sharpen the prompt instruction

  1. In Copilot Studio, open "Tools".
  2. Open the failing prompt.
  3. In the instruction, state the exact fields you expect.
  4. Remove any wording that invites explanations or commentary around the output.
  5. Select "Test".

✅ You should now see: a JSON response in the test output, without the error.

Solution 2

Official workaround

Slim down the JSON structure

  1. Remove every key your agent does not use afterwards.
  2. Flatten nested objects where a flat field carries the same information.
  3. Shorten example values to realistic, minimal content.
  4. Select "Test" again.

✅ You should now see: the error gone — and faster, cheaper responses as a side effect.

Check that it worked

Run "Test" in the prompt builder with three different realistic inputs. Expected: every run returns JSON with your keys and no error. Then call the prompt from your agent in the test pane.

If it didn't work

  • The instruction still invites prose. Wording like "explain your reasoning" pushes the model into commentary. Cut it.
  • The structure is still too ambitious. Halve the keys and retest. Grow the structure back step by step.
  • Your manual edits froze the format as "Custom". Frozen formats never update from tests again (record planned). Re-lock the format deliberately after structure changes.
  • The published agent still fails. Channels can serve an old version after edits. See Teams answers with an old version of your agent.

Prevent it next time

  • Start every JSON output with the smallest structure that works — slim structures fail less and cost less.
  • Treat instruction and structure edits like code changes: retest the prompt after each one.
  • Plan a deliberate re-lock step whenever your JSON structure evolves.

Evidence

  • Official documentationlearn.microsoft.com

    The JSON output documentation names the error verbatim and attributes it to the model wrapping the JSON with metadata that prevents format verification.

  • Official documentationlearn.microsoft.com

    Official performance guidance recommends simplifying the JSON structure and minimizing keys because unnecessary content increases cost and latency.