diff --git a/internal/comfy/gate.go b/internal/comfy/gate.go index a602e68..d6c2cfd 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 679d523..fdeabad 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") }