[GH-ISSUE #3173] [Issue]: Illustrator agent tag deduplication can break weighted tag blocks and cause invalid JSON #1705

Closed
opened 2026-10-21 05:41:52 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @SpicyMarinara on GitHub (Jul 3, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3173

Originally assigned to: @SpicyMarinara on GitHub.

Summary

The Illustrator agent's tag deduplication appears to partially deconstruct weighted/tag blocks such as (shaved head, bald:1.2). This can result in malformed prompt content and intermittent invalid JSON errors from the agent.

Expected behavior

Tag deduplication should treat complete tag blocks as atomic units and only remove or deduplicate whole blocks without splitting or partially removing their contents.

Actual behavior

Tags inside grouped/weighted blocks can appear partially extracted, such as (shaved head appearing without the full block. The Illustrator agent can then fail with: Connection: Agent returned invalid JSON instead of the requested image_prompt format. Check this agent's model/connection settings and try again.

Steps to reproduce

  1. Use Marinara Engine 2.0.9 with the Illustrator agent.
  2. Add grouped or weighted tag blocks to a character card or persona, for example (shaved head, bald:1.2).
  3. Generate an image prompt with the Illustrator agent.
  4. Observe whether tag deduplication partially deconstructs the tag block or the agent returns an invalid JSON error.
  5. Remove the grouped/weighted tag blocks from the card or persona and retry; the issue may stop occurring.

Environment

  • Marinara Engine version: 2.0.9
  • Install type: Not provided
  • OS + version: Not provided
  • Browser or app shell: Not provided

Logs, screenshots, or video

Reported error: Connection: Agent returned invalid JSON instead of the requested image_prompt format. Check this agent's model/connection settings and try again. Example prompt evidence included partial tag content: (shaved head instead of the full appearance tag block.

Additional context

The reporter noted that removing grouped/weighted tag blocks from the card or persona generally resolves the invalid JSON issue. A separate concern about Attach card appearance appending appearance after tag generation was discussed, but maintainers indicated that behavior is intentional and not an issue.

Discord thread: 2.0.9 Illustrator Agent tag issues
Discord thread link: https://discord.com/channels/1417099416812392641/1522501985591627796
Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653)

Discord thread transcript (7 messages)
[2026-07-03T07:19:20.084Z] Wozza: There are a couple of problems happening with the illustrator agent that make it difficult to build prompts for image-generators that work best with pure tag prompting.

**1)  Attach card appearance** causes appearance to be appended to the prompt after the tags have been generated by the main agent prompt.  As you can see in the example below this currently makes it impossible to use attach card appearance and get a pure tag prompt as output.  Example:

masterpiece, best quality, sharp focus, ultra-detailed, illustration, (by tonee:0.5), (by ebifurya:0.5), visual novel CG, cinematic composition, dramatic lighting, photo, 1boy, solo, (shaved head, bald:1.2), (grey beard, short beard, stubble:1.3), blue eyes, tall, lean build, wearing athletic gear, sleeveless shirt, looking at viewer, standing, palm open, glowing dark purple shadow rune hovering above palm, intricate geometric lines, (shining dark energy:1.2), background forge, anvils, orange glow, embers, soot-covered walls, industrial magical workshop, depth of field, cinematic lighting, realistic, **Character appearance notes:, Wozza Blackgrove's Appearance: Shaved head, Include this tag in image generation for this character (shaved head, (kotetsu t. kaburagi:0.35), (jet black \(cowboy bebop\):0.4)**

**What should happen:** It may be the only answer is to say don't use attach card appearance if you are not using natural language image prompting, but ideally there would be a way to get the appearance information available before the LLM call formats the final prompt.
[Discord message: https://discord.com/channels/1417099416812392641/1522501985591627796/1522501985591627796]

[2026-07-03T07:19:28.236Z] Wozza: **2) Tag deduplication is not respecting, tag blocks** like  (shaved head, bald:1.2) I believe situations are coming up where tags like this are partially deconstructed and this is leading to this error coming out of the illustrator agent **Connection: Agent returned invalid JSON instead of the requested image_prompt format. Check this agent's model/connection settings and try again. ** An example of this can be seen above **(shaved head** is not the full tag block from the appearance field. For some reason in this case it did not actually break the output JSON.

Currently when I start getting invalid JSON from the illustrator agent removing these tag blocks from the card or persona generally resolves the issue.

**What should happen:** Ideally the tag deduplication process should only consider complete tag blocks when deciding what to remove from a prompt.
[Discord message: https://discord.com/channels/1417099416812392641/1522501985591627796/1522502019783327824]

[2026-07-03T08:49:39.386Z] Marinara: 1) Just don't toggle on attach card appearance if you're using tags?
[Discord message: https://discord.com/channels/1417099416812392641/1522501985591627796/1522524715791683695]

[2026-07-03T08:49:46.920Z] Marinara: It does exactly what it says.
[Discord message: https://discord.com/channels/1417099416812392641/1522501985591627796/1522524747391303721]

[2026-07-03T08:49:57.309Z] Marinara: Some people prepare their cards' appearances to be tags specifically.
[Discord message: https://discord.com/channels/1417099416812392641/1522501985591627796/1522524790966194247]

[2026-07-03T08:49:59.218Z] Marinara: Not an issue.
[Discord message: https://discord.com/channels/1417099416812392641/1522501985591627796/1522524798972985506]

[2026-07-03T08:50:21.615Z] Marinara: 2) This is a valid error and should be fixed. 1 stays as it is now.
[Discord message: https://discord.com/channels/1417099416812392641/1522501985591627796/1522524892912816289]

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @SpicyMarinara on GitHub (Jul 3, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3173 Originally assigned to: @SpicyMarinara on GitHub. ## Summary The Illustrator agent's tag deduplication appears to partially deconstruct weighted/tag blocks such as `(shaved head, bald:1.2)`. This can result in malformed prompt content and intermittent `invalid JSON` errors from the agent. ## Expected behavior Tag deduplication should treat complete tag blocks as atomic units and only remove or deduplicate whole blocks without splitting or partially removing their contents. ## Actual behavior Tags inside grouped/weighted blocks can appear partially extracted, such as `(shaved head` appearing without the full block. The Illustrator agent can then fail with: `Connection: Agent returned invalid JSON instead of the requested image_prompt format. Check this agent's model/connection settings and try again.` ## Steps to reproduce 1. Use Marinara Engine 2.0.9 with the Illustrator agent. 2. Add grouped or weighted tag blocks to a character card or persona, for example `(shaved head, bald:1.2)`. 3. Generate an image prompt with the Illustrator agent. 4. Observe whether tag deduplication partially deconstructs the tag block or the agent returns an invalid JSON error. 5. Remove the grouped/weighted tag blocks from the card or persona and retry; the issue may stop occurring. ## Environment - Marinara Engine version: 2.0.9 - Install type: Not provided - OS + version: Not provided - Browser or app shell: Not provided ## Logs, screenshots, or video Reported error: `Connection: Agent returned invalid JSON instead of the requested image_prompt format. Check this agent's model/connection settings and try again.` Example prompt evidence included partial tag content: `(shaved head` instead of the full appearance tag block. ## Additional context The reporter noted that removing grouped/weighted tag blocks from the card or persona generally resolves the invalid JSON issue. A separate concern about `Attach card appearance` appending appearance after tag generation was discussed, but maintainers indicated that behavior is intentional and not an issue. Discord thread: 2.0.9 Illustrator Agent tag issues Discord thread link: https://discord.com/channels/1417099416812392641/1522501985591627796 Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653) <details> <summary>Discord thread transcript (7 messages)</summary> ```text [2026-07-03T07:19:20.084Z] Wozza: There are a couple of problems happening with the illustrator agent that make it difficult to build prompts for image-generators that work best with pure tag prompting. **1) Attach card appearance** causes appearance to be appended to the prompt after the tags have been generated by the main agent prompt. As you can see in the example below this currently makes it impossible to use attach card appearance and get a pure tag prompt as output. Example: masterpiece, best quality, sharp focus, ultra-detailed, illustration, (by tonee:0.5), (by ebifurya:0.5), visual novel CG, cinematic composition, dramatic lighting, photo, 1boy, solo, (shaved head, bald:1.2), (grey beard, short beard, stubble:1.3), blue eyes, tall, lean build, wearing athletic gear, sleeveless shirt, looking at viewer, standing, palm open, glowing dark purple shadow rune hovering above palm, intricate geometric lines, (shining dark energy:1.2), background forge, anvils, orange glow, embers, soot-covered walls, industrial magical workshop, depth of field, cinematic lighting, realistic, **Character appearance notes:, Wozza Blackgrove's Appearance: Shaved head, Include this tag in image generation for this character (shaved head, (kotetsu t. kaburagi:0.35), (jet black \(cowboy bebop\):0.4)** **What should happen:** It may be the only answer is to say don't use attach card appearance if you are not using natural language image prompting, but ideally there would be a way to get the appearance information available before the LLM call formats the final prompt. [Discord message: https://discord.com/channels/1417099416812392641/1522501985591627796/1522501985591627796] [2026-07-03T07:19:28.236Z] Wozza: **2) Tag deduplication is not respecting, tag blocks** like (shaved head, bald:1.2) I believe situations are coming up where tags like this are partially deconstructed and this is leading to this error coming out of the illustrator agent **Connection: Agent returned invalid JSON instead of the requested image_prompt format. Check this agent's model/connection settings and try again. ** An example of this can be seen above **(shaved head** is not the full tag block from the appearance field. For some reason in this case it did not actually break the output JSON. Currently when I start getting invalid JSON from the illustrator agent removing these tag blocks from the card or persona generally resolves the issue. **What should happen:** Ideally the tag deduplication process should only consider complete tag blocks when deciding what to remove from a prompt. [Discord message: https://discord.com/channels/1417099416812392641/1522501985591627796/1522502019783327824] [2026-07-03T08:49:39.386Z] Marinara: 1) Just don't toggle on attach card appearance if you're using tags? [Discord message: https://discord.com/channels/1417099416812392641/1522501985591627796/1522524715791683695] [2026-07-03T08:49:46.920Z] Marinara: It does exactly what it says. [Discord message: https://discord.com/channels/1417099416812392641/1522501985591627796/1522524747391303721] [2026-07-03T08:49:57.309Z] Marinara: Some people prepare their cards' appearances to be tags specifically. [Discord message: https://discord.com/channels/1417099416812392641/1522501985591627796/1522524790966194247] [2026-07-03T08:49:59.218Z] Marinara: Not an issue. [Discord message: https://discord.com/channels/1417099416812392641/1522501985591627796/1522524798972985506] [2026-07-03T08:50:21.615Z] Marinara: 2) This is a valid error and should be fixed. 1 stays as it is now. [Discord message: https://discord.com/channels/1417099416812392641/1522501985591627796/1522524892912816289] ``` </details> ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:41:52 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@SpicyMarinara commented on GitHub (Jul 3, 2026):

Codex is taking this in branch codex/issue-sweep-3169-3173, tracked by PR #3177.

<!-- gh-comment-id:4874768339 --> @SpicyMarinara commented on GitHub (Jul 3, 2026): Codex is taking this in branch `codex/issue-sweep-3169-3173`, tracked by PR #3177.
Author
Owner

@SpicyMarinara commented on GitHub (Jul 3, 2026):

Addressed in PR #3177. Local validation passed: pnpm regression:prompt; pnpm --filter @marinara-engine/shared build; pnpm check.

<!-- gh-comment-id:4874896533 --> @SpicyMarinara commented on GitHub (Jul 3, 2026): Addressed in PR #3177. Local validation passed: pnpm regression:prompt; pnpm --filter @marinara-engine/shared build; pnpm check.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1705
No description provided.