Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Merge branch 'catch-configure-errors' of https://github.com/pythongosssss/ComfyUI

comfyanonymousc982c937a702
diff --cc web/scripts/app.js
index 0d3ac1c30,a8729fb4f..0399ac722
--- a/web/scripts/app.js
+++ b/web/scripts/app.js
@@@ -864,18 -864,56 +864,62 @@@ class ComfyApp
graphData = structuredClone(defaultGraph);
}
- // Patch T2IAdapterLoader to ControlNetLoader since they are the same node now
+ const missingNodeTypes = [];
for (let n of graphData.nodes) {
+ // Patch T2IAdapterLoader to ControlNetLoader since they are the same node now
if (n.type == "T2IAdapterLoader") n.type = "ControlNetLoader";
+
+ // Find missing node types
+ if (!(n.type in LiteGraph.registered_node_types)) {
+ missingNodeTypes.push(n.type);
+ }
}
- this.graph.configure(graphData);
+ try {
+ this.graph.configure(graphData);
+ } catch (error) {
+ let errorHint = [];
+ // Try extracting filename to see if it was caused by an extension script
+ const filename = error.fileName || (error.stack || "").match(/(\/extensions\/.*\.js)/)?.[1];
+ const pos = (filename || "").indexOf("/extensions/");
+ if (pos > -1) {
+ errorHint.push(
+ $el("span", { textContent: "This may be due to the following script:" }),
+ $el("br"),
+ $el("span", {
+ style: {
+ fontWeight: "bold",
+ },
+ textContent: filename.substring(pos),
+ })
+ );
+ }
+
+ // Show dialog to let the user know something went wrong loading the data
+ this.ui.dialog.show(
+ $el("div", [
+ $el("p", { textContent: "Loading aborted due to error reloading workflow data" }),
+ $el("pre", {
+ style: { padding: "5px", backgroundColor: "rgba(255,0,0,0.2)" },
+ textContent: error.toString(),
+ }),
+ $el("pre", {
+ style: {
+ padding: "5px",
+ color: "#ccc",
+ fontSize: "10px",
+ maxHeight: "50vh",
+ overflow: "auto",
+ backgroundColor: "rgba(0,0,0,0.2)",
+ },
+ textContent: error.stack || "No stacktrace available",
+ }),
+ ...errorHint,
+ ]).outerHTML
+ );
+
+ return;
+ }
for (const node of this.graph._nodes) {
const size = node.computeSize();