Many Errors "Invalid knowledge graph: nodes.0.complexity: Invalid option: expected one of "simple"|"moderate"|"complex"; "
- Using Opencode
- Generation is fine, got the knowledge-graph.json
- Using 'understand-dashboard` to open dashboard in browser
- Browser show many simular errors:
Invalid knowledge graph: nodes.0.complexity: Invalid option: expected one of "simple"|"moderate"|"complex"; nodes.1.complexity: Invalid option: expected one of "simple"|"moderate"|"complex"; nodes.2.complexity: Invalid option: expected one of "simple"|"moderate"|"complex"; nodes.3.complexity: Invalid option: expected one of "simple"|"moderate"|"complex"; nodes.4.complexity: Invalid option: expected one of "simple"|"moderate"|"complex"; nodes.5.complexity: Invalid option: expected one of "simple"|"moderate"|"complex"; nodes.6.complexity: Invalid option: expected one of "simple"|"moderate"|"complex"; nodes.7.complexity: Invalid option: expected one of "simple"|"moderate"|"complex"; nodes.8.complexity: Invalid option: expected one of "simple"|"moderate"|"complex"; nodes.9.complexity: Invalid option: expected one of "simple"|"moderate"|"complex"; nodes.10.complexity: Invalid option: expected one of "simple"|"moderate"|"complex"; nodes.11.complexity: Invalid option: expected one of "simple"|"moderate"|"complex";...
and no digram shown.
Can you check the complexity field of the node that raising error? Seems your agent produce the wrong format of the knowledge graph.
You can also backup your generation and use the node scripts/generate-large-graph.mjs 100 to generate some fake data, and let me know if it works in the dashboard~
Thanks for your quick feedback!
Looks no any complexity at all, my node info looks like:
"nodes": [
{
"id": "file:backend/java/pitfallx-app-bes/src/main/java/com/ccssoft/bow/app/bes/Application.java",
"name": "Application.java",
"filePath": "backend/java/pitfallx-app-bes/src/main/java/com/ccssoft/bow/app/bes/Application.java",
"type": "file",
"summary": "BES (Backend Entity Service) application entry point. Spring Boot main class that bootstraps the API server.",
"tags": ["entry-point", "spring-boot", "application"]
},
I also tried your fake data, it works fine, I chekced the faked data like:
"nodes": [
{
"id": "node-0",
"type": "class",
"name": "class_0",
"summary": "Auto-generated class node #0 for performance testing.",
"tags": [
"class",
"group-0"
],
"complexity": "simple"
},
The complexity was included.
For the simplest way, you can ask your AI to write a Python script and insert the field to it, because the generation process will cost a lot of tokens.
So you mean just add '"complexity": "simple"' to each node? is there any other complexity than simple
By the way, is it a BUG or I made some mistake to result this issue?
Complexity includes: "simple"|"moderate"|"complex"
It is not a bug of the system, but I can make it more robust. It is because the opencode did not provide the field in the knowledge.
OK. I just made the changes, but sget some other errors:
Invalid knowledge graph: nodes.42.filePath: Invalid input: expected string, received null; nodes.43.filePath: Invalid input: expected string, received null; edges.0.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.1.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.2.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.3.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.4.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.5.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.6.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.7.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.8.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.9.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.10.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.11.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.12.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.13.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.14.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.15.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.16.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.17.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.18.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.19.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.20.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.21.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.22.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.23.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.24.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.25.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.26.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.27.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"; edges.28.direction: Invalid option: expected one of "forward"|"backward"|"bidirectional"
The problem is same as the field issue we discuss before. Can you ask your agent to double check the knowledge-graph? In the meantime, allow me to add some robustness enhancement to the dashboard for the LLM.
I faced a similar issue with function coming as func because the LLM was getting confused: https://github.com/Lum1104/Understand-Anything/issues/36
The fix in that case was to tweak the prompt and have a normalization step that converts similar sounding words to those in the schema. Maybe something like that can help?