microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.72k stars 28.71k forks source link

[File Watcher (node.js)] Error: ENAMETOOLONG: name too long #221583

Open jrieken opened 2 months ago

jrieken commented 2 months ago

See this in the console of insiders.. Looks like some ad-hoc chat model is ending up being file watched

ERR [File Watcher (node.js)] Error: ENAMETOOLONG: name too long, stat '/^/vscode-copilot-chat-code-block/4b3e2ea8-fd64-4d09-b875-d9770d5e94d4/response_0/0#{"references":[{"uri":{"$mid":1,"fsPath":"/Users/jrieken/Code/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.ts","external":"file:/Users/jrieken/Code/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.ts","path":"/Users/jrieken/Code/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.ts","scheme":"file"},"range":{"startLineNumber":21,"startColumn":3,"endLineNumber":21,"endColumn":72}},{"uri":{"$mid":1,"fsPath":"/Users/jrieken/Code/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.ts","external":"file:/Users/jrieken/Code/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.ts","path":"/Users/jrieken/Code/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.ts","scheme":"file"},"range":{"startLineNumber":1,"startColumn":1,"endLineNumber":297,"endColumn":1}},{"uri":{"$mid":1,"fsPath":"/Users/jrieken/Code/vscode/src/vs/workbench/api/common/extHostWorkspace.ts","external":"file:/Users/jrieken/Code/vscode/src/vs/workbench/api/common/extHostWorkspace.ts","path":"/Users/jrieken/Code/vscode/src/vs/workbench/api/common/extHostWorkspace.ts","scheme":"file"},"range":{"startLineNumber":238,"startColumn":1,"endLineNumber":250,"endColumn":3}},{"uri":{"$mid":1,"fsPath":"/Users/jrieken/Code/vscode/src/vs/workbench/browser/web.main.ts","external":"file:/Users/jrieken/Code/vscode/src/vs/workbench/browser/web.main.ts","path":"/Users/jrieken/Code/vscode/src/vs/workbench/browser/path/to/inlineChatSessionService'
mjbvz commented 2 months ago

Possibly a TypeScript bug as the ^ indicates that the file is in-memory file. We shouldn't create any file watchers for it

mjbvz commented 2 months ago

Couldn't repro this in my testing. @jrieken do you remember what you did to cause this?

I can add defensive code here but would prefer to understand the root cause first

mjbvz commented 1 month ago

Not 100% sure but I think this happens when one of the code blocks is a valid module. Adding guards to not watch in-memory resources and also filed an issue against TS

vs-code-engineering[bot] commented 1 month ago
        Issue marked as unreleased but unable to locate closing commit in issue timeline. You can manually reference a commit by commenting `\closedWith someCommitSha`, or directly add the `insiders-released` label if you know this has already been releaased
jrieken commented 3 weeks ago

verified in code

bpasero commented 1 week ago

@mjbvz this is still happening, it looks like paths can also end with a ^:

/Users/bpasero/Development/Microsoft/vscode/^

Steps:

I am not sure if its the same path, but I also see /^/review/ts-nul-authority in my selfhost file watcher logs.