facebook / facebook/pyrefly

Jupyter Lab: go-to-def does not work on dependencies

Open
#1,585 4 comments 0 reactions 0 assignees View on GitHub
language-server notebook
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

Attempt a go-to-def on `defaultdict` in

`from collections import defaultdict`

Error trace

```
[E 2025-11-14 23:58:18.460 ServerApp] Uncaught exception GET /api/contents/.lsp_symlink/var/folders/0_/dfqwztcn2hqcbgxqr_nrm99c0000gn/T/pyrefly_bundled_typeshed/collections/__init__.pyi?type=file&content=1&hash=1&format=text&contentProviderId=undefined&1763182698454 (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/contents/.lsp_symlink/var/folders/0_/dfqwztcn2hqcbgxqr_nrm99c0000gn/T/pyrefly_bundled_typeshed/collections/__init__.pyi?type=file&content=1&hash=1&format=text&contentProviderId=undefined&1763182698454', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "/Users/yangdanny/scratch/.venv/lib/python3.12/site-packages/jupyter_server/services/contents/handlers.py", line 156, in get
model = await ensure_async(
^^^^^^^^^^^^^^^^^^^
File "/Users/yangdanny/scratch/.venv/lib/python3.12/site-packages/jupyter_core/utils/__init__.py", line 214, in ensure_async
result = await obj
^^^^^^^^^
File "/Users/yangdanny/scratch/.venv/lib/python3.12/site-packages/jupyter_server/services/contents/filemanager.py", line 912, in get
raise web.HTTPError(404, "No such file or directory: %s" % path)
tornado.web.HTTPError: HTTP 404: Not Found (No such file or directory: .lsp_symlink/var/folders/0_/dfqwztcn2hqcbgxqr_nrm99c0000gn/T/pyrefly_bundled_typeshed/collections/__init__.pyi)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/yangdanny/scratch/.venv/lib/python3.12/site-packages/tornado/web.py", line 1848, in _execute
result = await result
^^^^^^^^^^^^
File "/Users/yangdanny/scratch/.venv/lib/python3.12/site-packages/jupyter_server/auth/decorator.py", line 73, in inner
return await out
^^^^^^^^^
File "/Users/yangdanny/scratch/.venv/lib/python3.12/site-packages/jupyter_server/services/contents/handlers.py", line 182, in get
await self._finish_error(
File "/Users/yangdanny/scratch/.venv/lib/python3.12/site-packages/jupyter_server/services/contents/handlers.py", line 114, in _finish_error
self.write(message)
File "/Users/yangdanny/scratch/.venv/lib/python3.12/site-packages/tornado/web.py", line 964, in write
raise RuntimeError("Cannot write() after finish()")
RuntimeError: Cannot write() after finish()
```

I'm pretty sure this is because we keep the stdlib files in-memory.

### Sandbox Link

_No response_

### (Only applicable for extension issues) IDE Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.