repairing-workflows
Classifies ComfyUI prompt/execution errors and plans a minimal partial rerun. Use whenever a submit_prompt result contains node_errors, or a WebSocket execution_error frame is observed, to decide betw
SKILL.md.claude/skills/repairing-workflows/SKILL.md
GitHubrepairing-workflows
Repair loop for ComfyUI prompts. Consumes the two error channels documented in
../comfyui-execution/reference/error-payloads.md:
- Channel 1
node_errorsfromPOST /promptvalidation - Channel 2
execution_errorframes from/ws
Produces a structured repair plan and a partial_execution_targets list that
minimises re-execution.
When this Skill applies
Invoke when any of the following is true:
submit_prompt.pystdout contains a non-emptynode_errorssubscribe_ws.pystdout has an{"type":"execution_error"}frame- A capability Skill's
compile.pyoutput failed to submit successfully - A downstream evaluator flagged a run as failed due to an engine error
Do not invoke for evaluator "criteria not met" failures — those route to the planner, not the repair loop.
Pipeline
scripts/classify_error.py— reads a unified error envelope on stdin, emits an error class ∈ {link,parameter,default,missing_resource} plus per-class hints.- Repair authoring (caller): apply the class-appropriate patch to the prompt JSON. Patches are deterministic JSON edits, not LLM-authored graph rewrites.
scripts/plan_partial_rerun.py— reads{prompt, failed_node_id, output_nodes}on stdin and emits{partial_execution_targets}covering only the failing subgraph and its descendants up to output nodes.- Re-submit via
comfyui-execution'ssubmit_prompt.pywith the targets.
Error classes
See reference/error-classes.md.
| Class | Trigger | Repair |
|---|---|---|
link |
bad_linked_input, return_type_mismatch, invalid_prompt |
Fix link tuple or add converter node |
parameter |
exception_during_validation, custom_validation_failed, runtime TypeError/ValueError with named input |
Patch parameter value |
default |
required_input_missing |
Supply default from object_info |
missing_resource |
value_not_in_list on a filename field (ckpt_name, lora_name, vae_name, embeddings) |
Route to setup wizard / list substitution |
Copilot's debug_agent.py analyze_error_type() covers three of these.
missing_resource is v1-specific and required by the acceptance test.
Repair strategies
See reference/repair-strategies.md for the patch recipes.
Scripts
scripts/classify_error.py— pure function, stdlib only. Input envelope:{"channel": "node_errors" | "execution_error", "payload": { ... }}Output:
{"class": "link|parameter|default|missing_resource", "node_id": "...", "hint": "...", "input_name": "..."}scripts/plan_partial_rerun.py— computes descendants of the failing node in the prompt graph up to any node inoutput_nodes, returns their IDs aspartial_execution_targets.
Explicit error handling
Both scripts must never raise an unhandled exception to the caller. On bad
input they emit {"error": "...", "code": "..."} with a non-zero exit code.
References
../comfyui-execution/reference/error-payloads.mdknowledge/workflows/ComfyUI_workflow.md§3 (partial_execution_targets), §4.4knowledge/plans/v1/plan_v1.md§6 Group C