Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Critical error on Subgraph creation #345

Closed
yojeek opened this issue Nov 22, 2023 · 2 comments · Fixed by #353
Closed

Critical error on Subgraph creation #345

yojeek opened this issue Nov 22, 2023 · 2 comments · Fixed by #353
Assignees
Labels
bug Something isn't working

Comments

@yojeek
Copy link
Contributor

yojeek commented Nov 22, 2023

To reproduce just create subgraph.

Looks like regression after 15a45c4

dependencyEngine.ts:117 Uncaught (in promise) Error: Could not find value for interface 1a0bdee1-baf8-4b9a-befe-783a77dc222c
This is likely a Baklava internal issue. Please report it on GitHub.
    at DependencyEngine.getInterfaceValue (dependencyEngine.ts:117:19)
    at DependencyEngine.runGraph (dependencyEngine.ts:48:33)
    at GraphNode.calculate (graphNode.ts:68:84)
    at DependencyEngine.runGraph (dependencyEngine.ts:44:29)
    at async DependencyEngine.execute (dependencyEngine.ts:107:16)
    at async DependencyEngine.runOnce (baseEngine.ts:195:28)
    at async DependencyEngine.calculateWithoutData (baseEngine.ts:278:16)

But probably the core reason is an attempt to recalculate subgraph while it's being destroyed https://github.com/newcat/baklavajs/blob/master/packages/core/src/graphNode.ts#L130 :

        private initialize() {
            if (this.subgraph) {
                this.subgraph.destroy();
            }
            this.subgraph = this.template.createGraph();
            this._title = this.template.name;
            this.updateInterfaces();
            this.events.update.emit(null);
        }
@yojeek yojeek changed the title Critical error on Subgraph creation Critical error on Subgraph creation ⚠️ Nov 22, 2023
@yojeek yojeek changed the title Critical error on Subgraph creation ⚠️ Critical error on Subgraph creation Nov 22, 2023
@chuteany
Copy link

chuteany commented Nov 28, 2023

I've encountered the same issue. As shown in the screenshot below, I created a Subgraph, and when I clicked the Save Subgraph
button, an error was logged in the console

Snipaste_2023-11-28_14-18-14

image

@newcat
Copy link
Owner

newcat commented Dec 20, 2023

This is a pretty big issue - both in terms of severity, as well as complexity unfortunately. In essence, the changes introduced by #328 added a conflicting system for how to handle inputs/outputs for graphs. Previously, I had separate inputs and outputs properties for graphs and graph templates, which acted as "virtual" input and output nodes. Now, the nodes are actually part of the graph, which is a nice change IMO. However, it creates a redundancy between the inputs/outputs properties and the subgraph input/output nodes. During calculations, the input values for the node interfaces coming from outside the graph are directly applied based on the inputs graph property. But since the subgraph input nodes are treated as normal nodes now, the engine expects them to have output values, which they don't have at the moment.

Ideally, I would just let the subgraph input nodes emit the outside value as their output value but I had a few issues when implementing it. In addition, I'd like to consolidate the input/output properties and input/output subgraph nodes, which is hard to do without creating breaking changes. I am working on it, but due to the complexity of the issue and the limited time I have available at the moment, it might still take a few more weeks until I am able to push a fix.

@newcat newcat self-assigned this Dec 20, 2023
@newcat newcat added the bug Something isn't working label Dec 20, 2023
@newcat newcat linked a pull request Dec 23, 2023 that will close this issue
newcat added a commit that referenced this issue Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants