Skip to content

[structure view] projects disappear from structure view #1677

Closed

Description

@martinlippert

Sometimes, after adding a project to the workspace, it appears in the structure view, and shortly after, it disappears again and never comes back. Pressing "Reload" doesn't help, the project doesn't show up again.

Other projects that have been showing up in the view before continue to show up.

After restarting VSCode, the missing project comes back to the structure view and everything looks like.

In one testing session, I saw the new project to appear in the structure view for a little while, even though it looked like the classpath of the project was still not complete (saw messages from the Java tooling about downloading dependencies from Maven). Opening the project in the structure reveals no content. And then, once the dependencies were all downloaded, the project disappeared again from the structure view.

Activity

  1. added this to the 5.0.0.RELEASE milestone on Oct 17, 2025
  2. martinlippert commented on Oct 17, 2025

    @martinlippert
    MemberAuthor

    One assumption here (still to be verified) that there is some stale cache data around, either from the index or from the Modulith service that causes the project to not produce any nodes anymore and therefore disappear from the view.

  3. martinlippert commented on Oct 17, 2025

    @martinlippert
    MemberAuthor

    I see this exception showing up in the log:

    java.lang.NullPointerException: Cannot invoke "String.length()" because "fqn" is null
    	at org.springframework.ide.vscode.boot.modulith.ModulithService.getPackageNameFromTypeFQName(ModulithService.java:435)
    	at org.springframework.ide.vscode.boot.modulith.AppModules.getModuleForType(AppModules.java:63)
    	at org.springframework.ide.vscode.boot.modulith.AppModules.getModuleNotExposingType(AppModules.java:29)
    	at org.springframework.ide.vscode.boot.java.reconcilers.ModulithTypeReferenceViolationReconciler$1.validate(ModulithTypeReferenceViolationReconciler.java:82)
    	at org.springframework.ide.vscode.boot.java.reconcilers.ModulithTypeReferenceViolationReconciler$1.visit(ModulithTypeReferenceViolationReconciler.java:70)
    	at org.springframework.ide.vscode.boot.java.reconcilers.CompositeASTVisitor.visit(CompositeASTVisitor.java:163)
    	at org.eclipse.jdt.core.dom.QualifiedName.accept0(QualifiedName.java:159)
    	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3312)
    	at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:3360)
    	at org.eclipse.jdt.core.dom.ImportDeclaration.accept0(ImportDeclaration.java:305)
    	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3312)
    	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:3383)
    	at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:256)
    	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3312)
    	at org.springframework.ide.vscode.boot.java.reconcilers.JdtReconciler.reconcile(JdtReconciler.java:133)
    	at org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava.reconcile(SpringIndexerJava.java:917)
    	at org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava.scanAST(SpringIndexerJava.java:876)
    	at org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava$5.acceptAST(SpringIndexerJava.java:501)
    	at org.springframework.ide.vscode.boot.java.utils.DelegatingFileASTRequestor.acceptAST(DelegatingFileASTRequestor.java:33)
    	at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1134)
    	at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:778)
    	at org.eclipse.jdt.core.dom.CompilationUnitResolver$ECJCompilationUnitResolver.resolve(CompilationUnitResolver.java:84)
    	at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:1107)
    	at org.springframework.ide.vscode.boot.java.utils.ASTParserCleanupEnabled.createASTs(ASTParserCleanupEnabled.java:91)
    	at org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava.scanFilesInternally(SpringIndexerJava.java:516)
    	at org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava.scanFiles(SpringIndexerJava.java:390)
    	at org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava.updateJavaFiles(SpringIndexerJava.java:209)
    	at org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava.updateFiles(SpringIndexerJava.java:197)
    	at org.springframework.ide.vscode.boot.app.SpringSymbolIndex.lambda$updateItems$43(SpringSymbolIndex.java:1040)
    	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(Unknown Source)
    	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	at java.base/java.lang.Thread.run(Unknown Source)
    

    Not sure though whether it is related or something totally different.

  4. martinlippert commented on Oct 17, 2025

    @martinlippert
    MemberAuthor

    Modulith metadata shows up in the log as:

    16:04:58.465 [pool-10-thread-6] INFO  o.s.i.v.b.modulith.ModulithService - Modulith metadata: {
      "core": {
        "displayName": "Core",
        "basePackage": "de.odrotbohm.restbucks.core",
        "nested": [],
        "type": "closed",
        "shared": false,
        "namedInterfaces": {
          "\u003c\u003cUNNAMED\u003e\u003e": [
            "de.odrotbohm.restbucks.core.MonetaryAmountAttributeConverter",
            "de.odrotbohm.restbucks.core.Currencies",
            "de.odrotbohm.restbucks.core.YearAttributeConverter"
          ]
        },
        "initializers": [],
        "dependencies": []
      },
      "drinks": {
        "displayName": "Drinks",
        "basePackage": "de.odrotbohm.restbucks.drinks",
        "nested": [],
        "type": "closed",
        "shared": false,
        "namedInterfaces": {
          "\u003c\u003cUNNAMED\u003e\u003e": [
            "de.odrotbohm.restbucks.drinks.Drinks",
            "de.odrotbohm.restbucks.drinks.Drink$DrinkIdentifier",
            "de.odrotbohm.restbucks.drinks.Size",
            "de.odrotbohm.restbucks.drinks.Drink",
            "de.odrotbohm.restbucks.drinks.DrinksOptions",
            "de.odrotbohm.restbucks.drinks.Milk"
          ]
        },
        "initializers": [],
        "dependencies": []
      },
      "order": {
        "displayName": "Order",
        "basePackage": "de.odrotbohm.restbucks.order",
        "nested": [],
        "type": "closed",
        "shared": false,
        "namedInterfaces": {
          "\u003c\u003cUNNAMED\u003e\u003e": [
            "de.odrotbohm.restbucks.order.Location",
            "de.odrotbohm.restbucks.order.Order$Status",
            "de.odrotbohm.restbucks.order.LineItem",
            "de.odrotbohm.restbucks.order.Order$OrderIdentifier",
            "de.odrotbohm.restbucks.order.Orders",
            "de.odrotbohm.restbucks.order.Order",
            "de.odrotbohm.restbucks.order.LineItem$LineItemIdentifier",
            "de.odrotbohm.restbucks.order.Order$OrderPaid",
            "de.odrotbohm.restbucks.order.OrderProjection"
          ]
        },
        "initializers": [],
        "dependencies": [
          {
            "target": "core",
            "types": [
              "DEFAULT"
            ]
          },
          {
            "target": "drinks",
            "types": [
              "USES_COMPONENT"
            ]
          }
        ]
      },
      "dashboard": {
        "displayName": "Dashboard",
        "basePackage": "de.odrotbohm.restbucks.dashboard",
        "nested": [],
        "type": "closed",
        "shared": false,
        "namedInterfaces": {
          "\u003c\u003cUNNAMED\u003e\u003e": []
        },
        "initializers": [],
        "dependencies": [
          {
            "target": "core",
            "types": [
              "DEFAULT"
            ]
          },
          {
            "target": "order",
            "types": [
              "EVENT_LISTENER"
            ]
          }
        ]
      },
      "engine": {
        "displayName": "Engine",
        "basePackage": "de.odrotbohm.restbucks.engine",
        "nested": [],
        "type": "closed",
        "shared": false,
        "namedInterfaces": {
          "\u003c\u003cUNNAMED\u003e\u003e": []
        },
        "initializers": [],
        "dependencies": [
          {
            "target": "order",
            "types": [
              "USES_COMPONENT",
              "EVENT_LISTENER"
            ]
          }
        ]
      },
      "payment": {
        "displayName": "Payment",
        "basePackage": "de.odrotbohm.restbucks.payment",
        "nested": [],
        "type": "closed",
        "shared": false,
        "namedInterfaces": {
          "\u003c\u003cUNNAMED\u003e\u003e": [
            "de.odrotbohm.restbucks.payment.CreditCard",
            "de.odrotbohm.restbucks.payment.CreditCardPayment",
            "de.odrotbohm.restbucks.payment.PaymentService",
            "de.odrotbohm.restbucks.payment.CreditCardNumber",
            "de.odrotbohm.restbucks.payment.Payment$PaymentIdentifier",
            "de.odrotbohm.restbucks.payment.Payment",
            "de.odrotbohm.restbucks.payment.Payment$Receipt",
            "de.odrotbohm.restbucks.payment.PaymentFailed"
          ]
        },
        "initializers": [],
        "dependencies": [
          {
            "target": "order",
            "types": [
              "USES_COMPONENT"
            ]
          }
        ]
      }
    }
    
  5. martinlippert commented on Oct 28, 2025

    @martinlippert
    MemberAuthor

    One of the issues that I came across is the project being a modulith project, but the modulith metadata cannot be read. One of the reasons for that was that the modulith service wasn't able to identify the main package, because the index for the project wasn't correct (more or less empty), because the classpath of the project didn't contain the java source folders, because the project definition on the pom.xml file had issues.

    To avoid stale cache data, the "refresh" action on the structure view UI now also wipes out cached modulith metadata, so that this metadata is re-computed again before building the tree structure: ae340e9

    With that, I will close this issue for now. Need to re-open in case I observe the disappearing project situation again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

for: vscodetheme: structural viewtype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions