From 354461d3bfd4f3dd41d6c068737f810202590e9f Mon Sep 17 00:00:00 2001 From: Ilker Manap Date: Sat, 10 Oct 2026 00:55:23 +0200 Subject: [PATCH] The gate makes the directories ComfyUI dies without ComfyUI lists its base directory's custom_nodes before anything else and exits when there is none. Co-Authored-By: Claude Opus 5.5 (1M context) --- internal/comfy/gate.go | 7 +++++++ internal/comfy/gate_test.go | 3 +++ 2 files changed, 10 insertions(+) diff --git a/internal/comfy/gate.go b/internal/comfy/gate.go index a602e684..d6c2cfd1 100644 --- a/internal/comfy/gate.go +++ b/internal/comfy/gate.go @@ -81,6 +81,13 @@ func RunGate(ctx context.Context, cfg GateConfig) error { if err != nil { return err } + // What ComfyUI expects to find in its base directory, and dies + // without: custom_nodes is listed before anything else is done. + for _, d := range []string{"custom_nodes", "input", "output", "temp", "user"} { + if err := os.MkdirAll(filepath.Join(state, d), 0o755); err != nil { + return err + } + } models := filepath.Join(state, "models") if err := LinkWeights(cfg.Weights, models); err != nil { return err diff --git a/internal/comfy/gate_test.go b/internal/comfy/gate_test.go index 679d523e..fdeabad7 100644 --- a/internal/comfy/gate_test.go +++ b/internal/comfy/gate_test.go @@ -174,6 +174,9 @@ func TestTheGateRunsComfyUIAndEndsWithIt(t *testing.T) { if _, err := os.Lstat(filepath.Join(state, "models", "flux.safetensors")); err != nil { t.Error("the weights were not shown to ComfyUI:", err) } + if _, err := os.Stat(filepath.Join(state, "custom_nodes")); err != nil { + t.Error("ComfyUI lists custom_nodes in its base directory first thing, and it is not there:", err) + } if get("/quit") != http.StatusNotFound { t.Error("a path the router never asks for was let through") }