Skip to content

[bug/lsp]panic: vfs: path "" is not absolute #670

@emosheeep

Description

@emosheeep

Don't know why does an empty string "" appear in the rootNames filed, which keeps crashing lsp server several times.

Info 14   [15:16:38.013] Open files: 
Info 14   [15:16:38.013] 	FileName: /Users/emosheep/projects/lvweb-tree/apps/ai-creator/src/services/digital-human-service/digital-human-service.ts ProjectRootPath: 
Info 14   [15:16:38.013] 		Projects: /Users/emosheep/projects/lvweb-tree/apps/ai-creator/tsconfig.json
Info 14   [15:16:38.013] 	FileName: /Users/emosheep/projects/lvweb-tree/apps/platform-business-ssr/src/hooks/use-user/login-plugins/ms-sdk/ms-sdk.tsx ProjectRootPath: 
Info 14   [15:16:38.013] 		Projects: /Users/emosheep/projects/lvweb-tree/apps/platform-business-ssr/tsconfig.json
Info 14   [15:16:38.014] getConfigFileNameForFile:: File: /Users/emosheep/projects/lvweb-tree/config/dist/types/constants/common/index.d.ts ProjectRootPath: :: Result: /Users/emosheep/projects/lvweb-tree/config/tsconfig.json
Info 15   [15:16:38.015] Creating KindConfiguredProject: /Users/emosheep/projects/lvweb-tree/config/tsconfig.json, currentDirectory: /Users/emosheep/projects/lvweb-tree/config
Info 16   [15:16:38.131] Config: /Users/emosheep/projects/lvweb-tree/config/tsconfig.json : {
      "options": {
        "allowUnreachableCode": false,
        "baseUrl": "/Users/emosheep/projects/lvweb-tree/config",
        "composite": true,
        "emitDecoratorMetadata": true,
        "declaration": true,
        "declarationDir": "/Users/emosheep/projects/lvweb-tree/config/dist/types",
        "declarationMap": true,
        "disableSourceOfProjectReferenceRedirect": false,
        "disableReferencedProjectLoad": true,
        "esModuleInterop": true,
        "experimentalDecorators": true,
        "lib": [
          "lib.esnext.d.ts",
          "lib.dom.d.ts",
          "lib.dom.iterable.d.ts"
        ],
        "module": 99,
        "moduleResolution": 100,
        "outDir": "/Users/emosheep/projects/lvweb-tree/config/dist",
        "resolveJsonModule": true,
        "rootDir": "/Users/emosheep/projects/lvweb-tree/config/src",
        "skipLibCheck": true,
        "strict": true,
        "sourceMap": true,
        "target": 99,
        "useDefineForClassFields": false,
        "verbatimModuleSyntax": true,
        "configFilePath": "/Users/emosheep/projects/lvweb-tree/config/tsconfig.json"
      },
      "projectReferences": [],
      "rootNames": [
        "/Users/emosheep/projects/lvweb-tree/config/src/apps.ts",
        "/Users/emosheep/projects/lvweb-tree/config/src/global.d.ts",
        "/Users/emosheep/projects/lvweb-tree/config/src/graphic.ts",
        "/Users/emosheep/projects/lvweb-tree/config/src/video-editor.ts",
        "",
        "/Users/emosheep/projects/lvweb-tree/config/src/config/commerce/commerce.ts",
        "/Users/emosheep/projects/lvweb-tree/config/src/config/domain/default.ts",
        "/Users/emosheep/projects/lvweb-tree/config/src/config/domain/ecommerce.ts",
        "/Users/emosheep/projects/lvweb-tree/config/src/config/favicon/default.ts",
        ...etc.
      ]
    }
panic: vfs: path "" is not absolute

goroutine 1 [running]:
github.com/microsoft/typescript-go/internal/vfs/internal.RootLength({0x0, 0x0})
	/Users/emosheep/projects/typescript-go/internal/vfs/internal/internal.go:22 +0x88
github.com/microsoft/typescript-go/internal/vfs/internal.SplitPath({0x0?, 0x1?})
	/Users/emosheep/projects/typescript-go/internal/vfs/internal/internal.go:29 +0x2c
github.com/microsoft/typescript-go/internal/vfs/internal.(*Common).RootAndPath(0x1038efe90, {0x0?, 0x1?})
	/Users/emosheep/projects/typescript-go/internal/vfs/internal/internal.go:36 +0x2c
github.com/microsoft/typescript-go/internal/vfs/internal.(*Common).ReadFile(0x30?, {0x0?, 0x9a928255d4e1418e?})
	/Users/emosheep/projects/typescript-go/internal/vfs/internal/internal.go:139 +0x20
github.com/microsoft/typescript-go/internal/vfs/osvfs.(*osFS).ReadFile(0x1038efe90, {0x0, 0x0})
	/Users/emosheep/projects/typescript-go/internal/vfs/osvfs/os.go:85 +0x6c
github.com/microsoft/typescript-go/internal/project.(*Service).getOrCreateScriptInfoWorker(0x140000a42c0, {0x0, 0x0}, {0x140631399e0, 0x23}, 0x0, 0x0, {0x0, 0x0}, 0x0)
	/Users/emosheep/projects/typescript-go/internal/project/service.go:301 +0x250
github.com/microsoft/typescript-go/internal/project.(*Service).getOrCreateScriptInfoNotOpenedByClient(...)
	/Users/emosheep/projects/typescript-go/internal/project/service.go:284
github.com/microsoft/typescript-go/internal/project.(*Service).loadConfiguredProject(0x140000a42c0, 0x14064b4dea0)
	/Users/emosheep/projects/typescript-go/internal/project/service.go:554 +0x4e4
github.com/microsoft/typescript-go/internal/project.(*Service).findCreateOrReloadConfiguredProject(0x140000a42c0, {0x1406313b840, 0x38}, 0x2, 0x0)
	/Users/emosheep/projects/typescript-go/internal/project/service.go:411 +0x118
github.com/microsoft/typescript-go/internal/project.(*Service).tryFindDefaultConfiguredProjectForOpenScriptInfo(0x140000a42c0, 0x140001ec6c0?, 0x2, 0x0)
	/Users/emosheep/projects/typescript-go/internal/project/service.go:423 +0x5c
github.com/microsoft/typescript-go/internal/project.(*Service).tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(...)
	/Users/emosheep/projects/typescript-go/internal/project/service.go:430
github.com/microsoft/typescript-go/internal/project.(*Service).assignProjectToOpenedScriptInfo(0x140000a42c0, 0x14002383b80)
	/Users/emosheep/projects/typescript-go/internal/project/service.go:437 +0x2c
github.com/microsoft/typescript-go/internal/project.(*Service).OpenFile(0x140000a42c0, {0x140752e9a47, 0x51}, {0x1405d43b980, 0x173}, 0x3, {0x0, 0x0})
	/Users/emosheep/projects/typescript-go/internal/project/service.go:112 +0xe4
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleDidOpen(0x140000a4210, 0x1400002d310?)
	/Users/emosheep/projects/typescript-go/internal/lsp/server.go:269 +0x19c
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleMessage(0x140000a4210, 0x140746d1140)
	/Users/emosheep/projects/typescript-go/internal/lsp/server.go:184 +0x1cc
github.com/microsoft/typescript-go/internal/lsp.(*Server).Run(0x140000a4210)
	/Users/emosheep/projects/typescript-go/internal/lsp/server.go:120 +0xb8
main.runLSP({0x14000010170, 0x1, 0x1})
	/Users/emosheep/projects/typescript-go/cmd/tsgo/lsp.go:52 +0x32c
main.main()
	/Users/emosheep/projects/typescript-go/cmd/tsgo/main.go:131 +0xb4
[Error - 15:16:38] Server process exited with code 2.
[Error - 15:16:38] The typescript-go-lsp server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

Activity

rezwanahmedsami

rezwanahmedsami commented on Mar 19, 2025

@rezwanahmedsami

Okay let me take a look on that

rezwanahmedsami

rezwanahmedsami commented on Mar 19, 2025

@rezwanahmedsami

@emosheeep You putting empty string on that ?

Or its generating empty string itself ?

emosheeep

emosheeep commented on Mar 19, 2025

@emosheeep
Author

No, I haven't changed it. That’s what it looked like.

emosheeep

emosheeep commented on Mar 19, 2025

@emosheeep
Author

This seems work, but only as a workaround, there're still some problems unresolved.

Image

files = append(files, file)

rezwanahmedsami

rezwanahmedsami commented on Mar 19, 2025

@rezwanahmedsami

No, I haven't changed it. That’s what it looked like.

ok let me see

rezwanahmedsami

rezwanahmedsami commented on Mar 21, 2025

@rezwanahmedsami

@emosheeep

rezwan@rezwan:~/devwork/tsgo_test$ /home/rezwan/devwork/typescript-go/built/local/tsgo tsc --init

Why its not generating any tsconfig.json file ?

jakebailey

jakebailey commented on Mar 21, 2025

@jakebailey
Member

That's not implemented yet. What does this have to do with your empty string panic?

rezwanahmedsami

rezwanahmedsami commented on Mar 21, 2025

@rezwanahmedsami

That's not implemented yet. What does this have to do with your empty string panic?

I want to face this empty string panic . So i can understand properly wheres the main issue

rezwanahmedsami

rezwanahmedsami commented on Mar 24, 2025

@rezwanahmedsami

@emosheeep give me your tsconfig.json, where where you getting issues

emosheeep

emosheeep commented on Mar 24, 2025

@emosheeep
Author

Here you are, this is the tsconfig that the problem file belongs to.

{
  "extends": "@edenx/tsconfig/base",
  "compilerOptions": {
    "declaration": true,
    "jsx": "preserve",
    "baseUrl": "./",
    "paths": {
      "@/*": ["./src/*"],
      "@shared/*": ["./shared/*"],
      "@common/*": ["./common/*"],
      "@api/*": ["./api/*"],
      "@config/*": ["./config/*"]
    },
    "types": ["react", "react-dom"],
    "module":"nodenext",
    "moduleResolution": "nodenext",
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "strictPropertyInitialization": false,
    "outDir": "dist",
    "declarationDir": "dist/types"
   },
  "include": ["src", "shared", "config", "server", "edenx.config.ts", "api"],
  "exclude": ["**/node_modules", "build"],
  "references": [
    {
      "path": "../../libs/component"
    },
    {
      "path": "../../libs/cookieConsent"
    },
    {
      "path": "../../libs/user"
    },
    {
      "path": "../../libs/reporter"
    },
    {
      "path": "../../libs/constants"
    },
    {
      "path": "../../libs/api"
    },
    {
      "path": "../../libs/hooks"
    },
    {
      "path": "../../libs/seo"
    },
    {
      "path": "../../libs/utils"
    },
    {
      "path": "../../libs/locale"
    },
    {
      "path": "../../libs/machine"
    },
    {
      "path": "../../libs/passport"
    },
    {
      "path": "../../plugins/infra"
    },
    {
      "path": "../../packages/global-request-hooks"
    },
    {
      "path": "../../config"
    },
    {
      "path": "../../packages/business/common-scss"
    },
    {
      "path": "../../packages/notify"
    }
  ]
}
emosheeep

emosheeep commented on Mar 24, 2025

@emosheeep
Author

And this is <root>/config/tsconfig.json

{
  "extends": "./tsconfig.browser.json",
  "compilerOptions": {
    "outDir": "dist",
    "declarationDir": "dist/types",
    "baseUrl": ".",
    "rootDir": "src"
  },
  "exclude": ["dist", "node_modules"],
  "include": ["src"]
}

and the <root>/config/tsconfig.browser.json

{
  "compilerOptions": {
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "strict": true,
    "allowUnreachableCode": false,
    "outDir": "${configDir}/dist",
    "target": "ESNext",
    "declaration": true,
    "lib": ["ESNext", "DOM", "DOM.Iterable"],
    "module": "ESNext",
    "esModuleInterop": true,
    "moduleResolution": "node",
    "verbatimModuleSyntax": true,
    "useDefineForClassFields": false,
    "resolveJsonModule": true,
    "sourceMap": true,
    "declarationMap": true,
    "disableReferencedProjectLoad": true,
    "disableSourceOfProjectReferenceRedirect": false,
    "skipLibCheck": true,
    "composite": true
    // "noImplicitOverride": true
  }
}
rezwanahmedsami

rezwanahmedsami commented on Mar 25, 2025

@rezwanahmedsami

Here you are, this is the tsconfig that the problem file belongs to.

{
"extends": "@edenx/tsconfig/base",
"compilerOptions": {
"declaration": true,
"jsx": "preserve",
"baseUrl": "./",
"paths": {
"@/": ["./src/"],
"@shared/": ["./shared/"],
"@common/": ["./common/"],
"@api/": ["./api/"],
"@config/": ["./config/"]
},
"types": ["react", "react-dom"],
"module":"nodenext",
"moduleResolution": "nodenext",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"strictPropertyInitialization": false,
"outDir": "dist",
"declarationDir": "dist/types"
},
"include": ["src", "shared", "config", "server", "edenx.config.ts", "api"],
"exclude": ["**/node_modules", "build"],
"references": [
{
"path": "../../libs/component"
},
{
"path": "../../libs/cookieConsent"
},
{
"path": "../../libs/user"
},
{
"path": "../../libs/reporter"
},
{
"path": "../../libs/constants"
},
{
"path": "../../libs/api"
},
{
"path": "../../libs/hooks"
},
{
"path": "../../libs/seo"
},
{
"path": "../../libs/utils"
},
{
"path": "../../libs/locale"
},
{
"path": "../../libs/machine"
},
{
"path": "../../libs/passport"
},
{
"path": "../../plugins/infra"
},
{
"path": "../../packages/global-request-hooks"
},
{
"path": "../../config"
},
{
"path": "../../packages/business/common-scss"
},
{
"path": "../../packages/notify"
}
]
}

I tested by this, i can't see any issue with that.

cartond

cartond commented on May 29, 2025

@cartond

@emosheeep We (@slackhq) saw this also. I narrowed this down to the fact we had 4 old files leftover after migrations. They had the same name as their new file, but a .js extension instead.

For example:

  • something.js left behind
  • something.ts is the new version
  • something.js resolves to "" in the rootfiles.

Can you confirm this is your case also? Based on your first message, it would mean you have a matching "/Users/emosheep/projects/lvweb-tree/config/src/config/commerce/commerce.js" file

emosheeep

emosheeep commented on Jun 4, 2025

@emosheeep
Author

@cartond No, I checked it just now, there isn't a file you said.

Image

jakebailey

jakebailey commented on Jul 24, 2025

@jakebailey
Member

It's been a month and there hasn't been a repro provided. We can't really do anything without something to test.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jakebailey@cartond@emosheeep@rezwanahmedsami

        Issue actions

          [bug/lsp]panic: vfs: path "" is not absolute · Issue #670 · microsoft/typescript-go