Understand-Anything icon indicating copy to clipboard operation
Understand-Anything copied to clipboard

Many Errors "Invalid knowledge graph: nodes.0.complexity: Invalid option: expected one of "simple"|"moderate"|"complex"; "

Open brainwang opened this issue 8 months ago • 9 comments

  • 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.

brainwang avatar Mar 25 '26 07:03 brainwang

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~

Lum1104 avatar Mar 25 '26 07:03 Lum1104

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.

brainwang avatar Mar 25 '26 08:03 brainwang

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.

Lum1104 avatar Mar 25 '26 08:03 Lum1104

So you mean just add '"complexity": "simple"' to each node? is there any other complexity than simple

brainwang avatar Mar 25 '26 08:03 brainwang

By the way, is it a BUG or I made some mistake to result this issue?

brainwang avatar Mar 25 '26 09:03 brainwang

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.

Lum1104 avatar Mar 25 '26 09:03 Lum1104

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"

brainwang avatar Mar 25 '26 09:03 brainwang

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.

Lum1104 avatar Mar 25 '26 09:03 Lum1104

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?

fishinakleinbottle avatar Mar 25 '26 11:03 fishinakleinbottle