Files
unraid-docker-manager/.planning/debug/text-commands-broken.md
Lucas Berger 07aeace1fd fix(16): resolve 3 UAT issues — update flow, batch cancel, text commands
- Fix update sub-workflow: remove unsupported GraphQL filter arg, fix node
  reference (Format Pull Error → Format Update Error), fix field case
  (data.image → data.Image)
- Fix batch cancel: connect Route Callback output 20 (batchcancel) to
  Prepare Batch UI Input (was empty connection array)
- Fix text commands: change .item.json to .first().json for paired item
  breakage after GraphQL chain expansion; convert Send Batch Confirmation
  from Telegram node to HTTP Request to fix double-serialized reply_markup

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 12:28:21 -05:00

89 lines
5.2 KiB
Markdown

---
status: verifying
trigger: "Text commands for start/stop don't work, and the batch text command confirmation dialog has no actionable buttons."
created: 2026-02-09T00:00:00Z
updated: 2026-02-09T19:00:00Z
---
## Current Focus
hypothesis: TWO root causes confirmed - (1) paired item breakage from GraphQL chain + sub-workflow calls, (2) Telegram node double-serializing reply_markup
test: Push fixed workflow to n8n and test text commands
expecting: Text start/stop commands execute successfully; batch confirmation shows clickable buttons
next_action: User verification of text commands and batch confirmation buttons
## Symptoms
expected: Text-based start/stop commands (e.g., "start plex") trigger container actions; batch text commands show confirmation with actionable buttons
actual: Text-based start/stop commands don't work at all; batch text command confirmation dialog has no actionable buttons
errors: "Paired item data for item from node 'Prepare Action Match Input' is unavailable" in Prepare Text Action Input node
reproduction: Send "start plex" or "stop sonarr" as text command; send "update all" for batch
started: After Phase 16-06 migration (Execute Command nodes replaced with GraphQL query chains)
## Eliminated
- hypothesis: Broken connections between GraphQL chain nodes and downstream nodes
evidence: All connections verified correct in workflow JSON. The chains (Query -> Normalize -> Registry -> Prepare Match Input) are properly wired.
timestamp: 2026-02-09T18:30:00Z
## Evidence
- timestamp: 2026-02-09T18:20:00Z
checked: n8n error executions (1514, 1516)
found: Both fail at "Prepare Text Action Input" node with error "Paired item data for item from node 'Prepare Action Match Input' is unavailable"
implication: The $('Parse Action Command').item.json reference cannot resolve paired items through the GraphQL chain + sub-workflow call
- timestamp: 2026-02-09T18:25:00Z
checked: Data flow through GraphQL chain
found: Query Containers (1 item) -> Normalize (22 items, one per container) -> Registry Update (22 items) -> Prepare Action Match Input (aggregates to 1 item via $input.all()) -> Execute Action Match (sub-workflow, breaks paired items) -> Route Action Match Result -> Prepare Text Action Input (tries $('Parse Action Command').item.json -> FAILS)
implication: Sub-workflow calls completely reset paired item tracking. Using .item.json to reference nodes before the sub-workflow is invalid.
- timestamp: 2026-02-09T18:30:00Z
checked: Execution 1512 (successful batch keyboard send)
found: "Send Batch Confirmation" (Telegram node) sends message successfully (HTTP 200) but response shows NO inline keyboard buttons. Build Batch Keyboard output has valid reply_markup object.
implication: n8n Telegram node's additionalFields.reply_markup with JSON.stringify() likely double-serializes, causing Telegram to silently ignore the markup
- timestamp: 2026-02-09T18:35:00Z
checked: All reply_markup patterns across all 8 workflow files
found: ALL other nodes that send inline keyboards use HTTP Request nodes with reply_markup as nested object inside JSON.stringify(). Only "Send Batch Confirmation" uses the n8n Telegram node.
implication: The Telegram node approach is unique and broken; HTTP Request pattern works reliably
- timestamp: 2026-02-09T18:40:00Z
checked: Prepare Batch Execution node code
found: Uses $('Detect Batch Command').item.json which has same paired item breakage (downstream of GraphQL chain + Execute Batch Match sub-workflow)
implication: Batch text commands would also fail with paired item error, same root cause as action commands
## Resolution
root_cause: |
TWO distinct root causes, both introduced by Phase 16-06 migration:
1. PAIRED ITEM BREAKAGE: Two Code nodes use $('NodeName').item.json to reference upstream
nodes, but the reference traverses both a GraphQL normalizer chain (which expands 1 item
to 22 items) AND a sub-workflow call (Execute Match), both of which break n8n's paired
item tracking. Affected nodes:
- "Prepare Text Action Input": $('Parse Action Command').item.json
- "Prepare Batch Execution": $('Detect Batch Command').item.json
2. TELEGRAM NODE REPLY_MARKUP: "Send Batch Confirmation" uses n8n Telegram node with
reply_markup in additionalFields set to JSON.stringify($json.reply_markup). The Telegram
node double-serializes this, causing Telegram API to receive an escaped string instead
of a JSON object for reply_markup, so buttons are silently dropped.
fix: |
Three changes to n8n-workflow.json:
1. Prepare Text Action Input: Changed $('Parse Action Command').item.json to .first().json
(.first() doesn't require paired item tracking - it always returns the first output item)
2. Prepare Batch Execution: Changed $('Detect Batch Command').item.json to .first().json
(same fix, same reason)
3. Send Batch Confirmation: Converted from n8n Telegram node to HTTP Request node
(matching the pattern used by ALL other confirmation messages in the project).
New config sends JSON body with reply_markup as a nested object, not double-serialized.
verification: Workflow pushed to n8n (HTTP 200). Awaiting user verification of text commands.
files_changed:
- n8n-workflow.json