typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

panic: vfs: path is not absolute

Open LukeAbby opened this issue 2 months ago • 2 comments

Stack trace

panic: vfs: path "https://deno.land/[email protected]/path/mod.ts" is not absolute

goroutine 49 [running]:
github.com/microsoft/typescript-go/internal/vfs/internal.RootLength({0xc00015644e, 0x29})
	github.com/microsoft/typescript-go/internal/vfs/internal/internal.go:23 +0x88
github.com/microsoft/typescript-go/internal/vfs/internal.SplitPath({0xc00015644e?, 0xc0001f4f20?})
	github.com/microsoft/typescript-go/internal/vfs/internal/internal.go:30 +0x27
github.com/microsoft/typescript-go/internal/vfs/internal.(*Common).RootAndPath(0x14890f0, {0xc00015644e?, 0xb0b3c0?})
	github.com/microsoft/typescript-go/internal/vfs/internal/internal.go:37 +0x25
github.com/microsoft/typescript-go/internal/vfs/internal.(*Common).Stat(0xc0001f4f30?, {0xc00015644e?, 0xc00031ea38?})
	github.com/microsoft/typescript-go/internal/vfs/internal/internal.go:45 +0x18
github.com/microsoft/typescript-go/internal/vfs/internal.(*Common).DirectoryExists(0xc0001f4f20?, {0xc00015644e?, 0x29?})
	github.com/microsoft/typescript-go/internal/vfs/internal/internal.go:62 +0x18
github.com/microsoft/typescript-go/internal/vfs/osvfs.(*osFS).DirectoryExists(0xc000366320?, {0xc00015644e?, 0xc00015644e?})
	github.com/microsoft/typescript-go/internal/vfs/osvfs/os.go:91 +0x1a
github.com/microsoft/typescript-go/internal/vfs/cachedvfs.(*FS).DirectoryExists(0xc00031ea20, {0xc00015644e, 0x29})
	github.com/microsoft/typescript-go/internal/vfs/cachedvfs/cachedvfs.go:55 +0x67
github.com/microsoft/typescript-go/internal/project.(*compilerFS).DirectoryExists(0xc000366320?, {0xc00015644e, 0x29})
	github.com/microsoft/typescript-go/internal/project/compilerhost.go:146 +0x3b
github.com/microsoft/typescript-go/internal/module.(*resolutionState).getPackageJsonInfo(0xc00012f040, {0xc00015644e, 0x29}, 0x0)
	github.com/microsoft/typescript-go/internal/module/resolver.go:1674 +0x64a
github.com/microsoft/typescript-go/internal/module.(*resolutionState).loadModuleFromSpecificNodeModulesDirectory(0xc00012f040, 0x4, {0xc000294067, 0x29}, {0xc000152cf0, 0x2e}, 0x1)
	github.com/microsoft/typescript-go/internal/module/resolver.go:963 +0x125
github.com/microsoft/typescript-go/internal/module.(*resolutionState).loadModuleFromImmediateNodeModulesDirectory(0xc00012f040, 0x4, {0xc00002cb40?, 0x29?}, 0x0)
	github.com/microsoft/typescript-go/internal/module/resolver.go:939 +0x218
github.com/microsoft/typescript-go/internal/module.(*Resolver).tryResolveFromTypingsLocation(0xc000368180, {0xc000294067, 0x29}, {0xc000234cc7, 0x27}, 0xc00016e0e0, 0x0)
	github.com/microsoft/typescript-go/internal/module/resolver.go:290 +0x2dc
github.com/microsoft/typescript-go/internal/module.(*Resolver).ResolveModuleName(0xc000368180, {0xc000294067, 0x29}, {0xc000234cc7, 0x2e}, 0x63, {0xe9b9c8, 0x0})
	github.com/microsoft/typescript-go/internal/module/resolver.go:267 +0xb08
github.com/microsoft/typescript-go/internal/compiler.(*fileLoader).resolveImportsAndModuleAugmentations(0xc000346e08, 0xc00031eb40)
	github.com/microsoft/typescript-go/internal/compiler/fileloader.go:546 +0x7e5
github.com/microsoft/typescript-go/internal/compiler.(*parseTask).load(0xc00031eb40, 0xc000346e08)
	github.com/microsoft/typescript-go/internal/compiler/filesparser.go:117 +0x3b8
github.com/microsoft/typescript-go/internal/compiler.(*filesParser).start.func1()
	github.com/microsoft/typescript-go/internal/compiler/filesparser.go:220 +0x165
github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue.func1()
	github.com/microsoft/typescript-go/internal/core/workgroup.go:42 +0x50
created by github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue in goroutine 34
	github.com/microsoft/typescript-go/internal/core/workgroup.go:40 +0x85
[Error - 10:48:13 PM] The typescript.native-preview-lsp server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 10:48:13 PM] Server process exited with code 2.
Restarting language server...
[22:48:47.066] Processed 1 file changes in 61.147µs
panic: vfs: path "https://deno.land/[email protected]/path/mod.ts" is not absolute

goroutine 33 [running]:
github.com/microsoft/typescript-go/internal/vfs/internal.RootLength({0xc00045014e, 0x29})
	github.com/microsoft/typescript-go/internal/vfs/internal/internal.go:23 +0x88
github.com/microsoft/typescript-go/internal/vfs/internal.SplitPath({0xc00045014e?, 0xc000182f20?})
	github.com/microsoft/typescript-go/internal/vfs/internal/internal.go:30 +0x27
github.com/microsoft/typescript-go/internal/vfs/internal.(*Common).RootAndPath(0x14890f0, {0xc00045014e?, 0xc000182f78?})
	github.com/microsoft/typescript-go/internal/vfs/internal/internal.go:37 +0x25
github.com/microsoft/typescript-go/internal/vfs/internal.(*Common).Stat(0xc000182f30?, {0xc00045014e?, 0xc000228a38?})
	github.com/microsoft/typescript-go/internal/vfs/internal/internal.go:45 +0x18
github.com/microsoft/typescript-go/internal/vfs/internal.(*Common).DirectoryExists(0xc000182f20?, {0xc00045014e?, 0x29?})
	github.com/microsoft/typescript-go/internal/vfs/internal/internal.go:62 +0x18
github.com/microsoft/typescript-go/internal/vfs/osvfs.(*osFS).DirectoryExists(0xc000268320?, {0xc00045014e?, 0xc00045014e?})
	github.com/microsoft/typescript-go/internal/vfs/osvfs/os.go:91 +0x1a
github.com/microsoft/typescript-go/internal/vfs/cachedvfs.(*FS).DirectoryExists(0xc000228a20, {0xc00045014e, 0x29})
	github.com/microsoft/typescript-go/internal/vfs/cachedvfs/cachedvfs.go:55 +0x67
github.com/microsoft/typescript-go/internal/project.(*compilerFS).DirectoryExists(0xc000268320?, {0xc00045014e, 0x29})
	github.com/microsoft/typescript-go/internal/project/compilerhost.go:146 +0x3b
github.com/microsoft/typescript-go/internal/module.(*resolutionState).getPackageJsonInfo(0xc0004249c0, {0xc00045014e, 0x29}, 0x0)
	github.com/microsoft/typescript-go/internal/module/resolver.go:1674 +0x64a
github.com/microsoft/typescript-go/internal/module.(*resolutionState).loadModuleFromSpecificNodeModulesDirectory(0xc0004249c0, 0x4, {0xc000034f08, 0x29}, {0xc000444a80, 0x2e}, 0x1)
	github.com/microsoft/typescript-go/internal/module/resolver.go:963 +0x125
github.com/microsoft/typescript-go/internal/module.(*resolutionState).loadModuleFromImmediateNodeModulesDirectory(0xc0004249c0, 0x4, {0xc00002c270?, 0x29?}, 0x0)
	github.com/microsoft/typescript-go/internal/module/resolver.go:939 +0x218
github.com/microsoft/typescript-go/internal/module.(*Resolver).tryResolveFromTypingsLocation(0xc0002001e0, {0xc000034f08, 0x29}, {0xc000034e87, 0x27}, 0xc0004520e0, 0x0)
	github.com/microsoft/typescript-go/internal/module/resolver.go:290 +0x2dc
github.com/microsoft/typescript-go/internal/module.(*Resolver).ResolveModuleName(0xc0002001e0, {0xc000034f08, 0x29}, {0xc000034e87, 0x2e}, 0x63, {0xe9b9c8, 0x0})
	github.com/microsoft/typescript-go/internal/module/resolver.go:267 +0xb08
github.com/microsoft/typescript-go/internal/compiler.(*fileLoader).resolveImportsAndModuleAugmentations(0xc000248e08, 0xc000228b40)
	github.com/microsoft/typescript-go/internal/compiler/fileloader.go:546 +0x7e5
github.com/microsoft/typescript-go/internal/compiler.(*parseTask).load(0xc000228b40, 0xc000248e08)
	github.com/microsoft/typescript-go/internal/compiler/filesparser.go:117 +0x3b8
github.com/microsoft/typescript-go/internal/compiler.(*filesParser).start.func1()
	github.com/microsoft/typescript-go/internal/compiler/filesparser.go:220 +0x165
github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue.func1()
	github.com/microsoft/typescript-go/internal/core/workgroup.go:42 +0x50
created by github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue in goroutine 7
	github.com/microsoft/typescript-go/internal/core/workgroup.go:40 +0x85

Steps to reproduce

  1. Run the TypeScript native-preview extension
  2. Create a file with import "https://deno.land/[email protected]/path/mod.ts" or another similar URL.

LukeAbby avatar Oct 19 '25 05:10 LukeAbby

configuration: [map[autoClosingTags:true check:map[npmIsInstalled:true] disableAutomaticTypeAcquisition:false enablePromptUseWorkspaceTsdk:false experimental:map[useTsgo:true] format:map[enable:true indentSwitchCase:true insertSpaceAfterCommaDelimiter:true insertSpaceAfterConstructor:false insertSpaceAfterFunctionKeywordForAnonymousFunctions:true insertSpaceAfterKeywordsInControlFlowStatements:true insertSpaceAfterOpeningAndBeforeClosingEmptyBraces:true insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces:false insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces:true insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets:false insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis:false insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces:false insertSpaceAfterSemicolonInForStatements:true insertSpaceAfterTypeAssertion:false insertSpaceBeforeAndAfterBinaryOperators:true insertSpaceBeforeFunctionParenthesis:false placeOpenBraceOnNewLineForControlBlocks:false placeOpenBraceOnNewLineForFunctions:false semicolons:remove] implementationsCodeLens:map[enabled:false showOnAllClassMethods:false showOnInterfaceMethods:false] inlayHints:map[enumMemberValues:map[enabled:false] functionLikeReturnTypes:map[enabled:false] parameterNames:map[enabled:none suppressWhenArgumentMatchesName:true] parameterTypes:map[enabled:false] propertyDeclarationTypes:map[enabled:false] variableTypes:map[enabled:false suppressWhenTypeMatchesName:true]] locale:auto native-preview:map[pprofDir: trace:map[server:verbose] tsdk:] npm: preferGoToSourceDefinition:false preferences:map[autoImportFileExcludePatterns:[] autoImportSpecifierExcludeRegexes:[] importModuleSpecifier:shortest importModuleSpecifierEnding:auto includePackageJsonAutoImports:on jsxAttributeCompletionStyle:auto organizeImports:map[] preferTypeOnlyAutoImports:false quoteStyle:auto renameMatchingJsxTags:true useAliasesForRenames:true] referencesCodeLens:map[enabled:false showOnAllFunctions:false] reportStyleChecksAsWarnings:true suggest:map[autoImports:true classMemberSnippets:map[enabled:true] completeFunctionCalls:false completeJSDocs:true enabled:true includeAutomaticOptionalChainCompletions:true includeCompletionsForImportStatements:true jsdoc:map[generateReturns:true] objectLiteralMethodSnippets:map[enabled:true] paths:true] suggestionActions:map[enabled:true] tsc:map[autoDetect:on] tsdk: tsserver:map[enableRegionDiagnostics:true enableTracing:false experimental:map[enableProjectDiagnostics:false] log:requestTime maxTsServerMemory:3072 nodePath: pluginPaths:[] useSyntaxServer:never watchOptions:vscode web:map[projectWideIntellisense:map[enabled:true suppressSemanticErrors:false] typeAcquisition:map[enabled:true]]] updateImportsOnFileMove:map[enabled:prompt] updateImportsOnPaste:map[enabled:true] validate:map[enable:true] workspaceSymbols:map[excludeLibrarySymbols:true scope:allOpenProjects]]], []interface {}

[09:58:41.789] Processed 1 file changes in 12µs panic: vfs: path "file:///Users/ioloii/Desktop/The%20Pearl%20River%20Water%20Conservancy%20Research%20Institute/model-gpa2/model-gpa/client/model_web/node_modules/vite/dist/node/index.js" is not absolute

goroutine 15 [running]: github.com/microsoft/typescript-go/internal/vfs/internal.RootLength({0x14000390308, 0xa8}) github.com/microsoft/typescript-go/internal/vfs/internal/internal.go:23 +0x84 github.com/microsoft/typescript-go/internal/vfs/internal.SplitPath({0x14000390308?, 0x14002cb1028?}) github.com/microsoft/typescript-go/internal/vfs/internal/internal.go:30 +0x2c github.com/microsoft/typescript-go/internal/vfs/internal.(*Common).RootAndPath(0x1017a9970, {0x14000390308?, 0xffffffffffffffff?}) github.com/microsoft/typescript-go/internal/vfs/internal/internal.go:37 +0x2c github.com/microsoft/typescript-go/internal/vfs/internal.(*Common).Stat(0xb5?, {0x14000390308?, 0x14002cb1038?}) github.com/microsoft/typescript-go/internal/vfs/internal/internal.go:45 +0x20 github.com/microsoft/typescript-go/internal/vfs/internal.(*Common).DirectoryExists(0x100f54940?, {0x14000390308?, 0x14000390308?}) github.com/microsoft/typescript-go/internal/vfs/internal/internal.go:62 +0x20 github.com/microsoft/typescript-go/internal/vfs/osvfs.(*osFS).DirectoryExists(0x14002cb1088?, {0x14000390308?, 0x14000390308?}) github.com/microsoft/typescript-go/internal/vfs/osvfs/os.go:91 +0x24 github.com/microsoft/typescript-go/internal/vfs/cachedvfs.(*FS).DirectoryExists(0x14000365680, {0x14000390308, 0xa8}) github.com/microsoft/typescript-go/internal/vfs/cachedvfs/cachedvfs.go:55 +0x6c github.com/microsoft/typescript-go/internal/project.(*compilerFS).DirectoryExists(0x140004900a0?, {0x14000390308, 0xa8}) github.com/microsoft/typescript-go/internal/project/compilerhost.go:147 +0x44 github.com/microsoft/typescript-go/internal/module.(*resolutionState).getPackageJsonInfo(0x1400de25e10, {0x14000390308, 0xa8}, 0x0) github.com/microsoft/typescript-go/internal/module/resolver.go:1678 +0x56c github.com/microsoft/typescript-go/internal/module.(*resolutionState).loadModuleFromSpecificNodeModulesDirectory(0x1400de25e10, 0x4, {0x14000565530, 0xa8}, {0x1400de77500, 0x38}, 0x1) github.com/microsoft/typescript-go/internal/module/resolver.go:967 +0xbc github.com/microsoft/typescript-go/internal/module.(*resolutionState).loadModuleFromImmediateNodeModulesDirectory(0x1400de25e10, 0x4, {0x1400015a900?, 0x32?}, 0x0) github.com/microsoft/typescript-go/internal/module/resolver.go:943 +0x1d8 github.com/microsoft/typescript-go/internal/module.(*Resolver).tryResolveFromTypingsLocation(0x14000201e00, {0x14000565530, 0xa8}, {0x1400035e5b0, 0x32}, 0x1400d5f5ce0, 0x0) github.com/microsoft/typescript-go/internal/module/resolver.go:294 +0x290 github.com/microsoft/typescript-go/internal/module.(*Resolver).ResolveModuleName(0x14000201e00, {0x14000565530, 0xa8}, {0x1400035e5b0, 0x6a}, 0x63, {0x101191408, 0x0}) github.com/microsoft/typescript-go/internal/module/resolver.go:271 +0x9f0 github.com/microsoft/typescript-go/internal/compiler.(*fileLoader).resolveImportsAndModuleAugmentations(0x140001be008, 0x14000180fc0) github.com/microsoft/typescript-go/internal/compiler/fileloader.go:539 +0x5f0 github.com/microsoft/typescript-go/internal/compiler.(*parseTask).load(0x14000180fc0, 0x140001be008) github.com/microsoft/typescript-go/internal/compiler/filesparser.go:117 +0x30c github.com/microsoft/typescript-go/internal/compiler.(*filesParser).start.func1() github.com/microsoft/typescript-go/internal/compiler/filesparser.go:220 +0x170 github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue.func1() github.com/microsoft/typescript-go/internal/core/workgroup.go:40 +0x24 sync.(*WaitGroup).Go.func1() sync/waitgroup.go:239 +0x4c created by sync.(*WaitGroup).Go in goroutine 33 sync/waitgroup.go:237 +0x70 [Error - 09:58:41] Server process exited with code 2. [Error - 09:58:41] The typescript.native-preview-lsp server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

Even if I delete node_modules or migrate/modify the project path, this error still appears, and it always points to the same address (files in the original project path).

Current project address: "/Users/ioloii/Desktop/project/front/client/website" (This is the address after I copied the original project, deleted node_modules, and reinstalled them—the same project).

The address still reported in the error: "file:///Users/ioloii/Desktop/The%20Pearl%20River%20Water%20Conservancy%20Research%20Institute/model-gpa2/model-gpa/client/model_web/node_modules/vite/dist/node/index.js"

IOLOII avatar Dec 03 '25 02:12 IOLOII

I am using this plugin in a Vue project, where the code includes both TypeScript and JavaScript. When I open a JavaScript or TypeScript file, it prompts a crash message.

https://github.com/microsoft/typescript-go/issues/670#issuecomment-3114783292

I'll provide a project repository or code to reproduce the issue later if I have extra time.

IOLOII avatar Dec 03 '25 02:12 IOLOII