microsoft/typescript-go · error

invalid URI: %s

Error message

invalid URI: %s

What it means

Error "invalid URI: %s" thrown in microsoft/typescript-go.

Source

Thrown at internal/lsp/lsproto/lsp.go:38

	if bundled.IsBundled(string(uri)) {
		return string(uri)
	}
	if strings.HasPrefix(string(uri), "file://") {
		parsed, err := url.Parse(string(uri))
		if err != nil {
			panic(fmt.Sprintf("invalid file URI: %s", uri))
		}
		if parsed.Host != "" {
			return "//" + parsed.Host + parsed.Path
		}
		return fixWindowsURIPath(parsed.Path)
	}

	// Leave all other URIs escaped so we can round-trip them.

	scheme, path, ok := strings.Cut(string(uri), ":")
	if !ok {
		panic(fmt.Sprintf("invalid URI: %s", uri))
	}

	authority := "ts-nul-authority"
	if rest, ok := strings.CutPrefix(path, "//"); ok {
		authority, path, ok = strings.Cut(rest, "/")
		if !ok {
			panic(fmt.Sprintf("invalid URI: %s", uri))
		}
	}

	return "^/" + scheme + "/" + authority + "/" + path
}

func (uri DocumentUri) Path(useCaseSensitiveFileNames bool) tspath.Path {
	fileName := uri.FileName()
	return tspath.ToPath(fileName, "", useCaseSensitiveFileNames)
}

View on GitHub (pinned to 1bcfa18d79)

When it happens

Trigger: Thrown at internal/lsp/lsproto/lsp.go:38 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16). Data as JSON: /api/errors/48169543c1a936b6. Report an issue: GitHub.