Repository navigation
Collecting data for an investigation.
- Enable trace logging by adding
"python.analysis.logLevel": "Trace"to your settings.json configuration file. - Select
"View: Toggle Output"from the command palette (Ctrl+Shift+P on Windows/Linux, Command+Shift+P on macOS), then select"Python Language Server"in the dropdown on the right. - Copy the entire log starting with
"Pylance language server XXX (pyright xxx) starting"
The output will be substantial, but having the full log will help people investigating what is happening
- You can confirm you have the correct log by checking for entries such as the one below.
Search paths for file:///c%3A/repo/test
c:\repo\test
c:\repo\test\src
c:\repo\test\.venv
c:\repo\test\.venv\Lib\site-packages
Adding fs watcher for library directories:
file:///c%3A/repo/test/.venv
file:///c%3A/repo/test/.venv/Lib/site-packages
Adding fs watcher for directories:
file:///c%3A/repo/test
You can also save the log by using the Pylance: Start Logging and Pylance: Stop Logging commands. Simply start logging, perform your repro, stop logging, and then share the saved log file with us.
[available in 2025.4.1 and after]
When you encounter an issue with Pylance and need to report it, the extension can automatically upload your logs to GitHub. Here’s how the process works:
- Add
"python.analysis.logLevel": "Trace"to your settings.json configuration file.
- Ensure trace logging is enabled before proceeding with reproduction.
- Select
"Pylance: Report Issue"from the command palette (Ctrl+Shift+P on Windows/Linux, Command+Shift+P on macOS).
- If the log size exceeds issue size limit(65K), Pylance will prompt you for consent to upload the log as a blob to GitHub.
You will see a message asking for consent or a decline.
If you consent, Pylance will upload the log to a GitHub blob and attach the SHA of the log to the issue. How to retrieve logs from a blob?
If you decline, the log will be truncated and shown in the issue reporter board.
- Fill in the required repro steps, then click
Create on Githubbutton
- set
python.analysis.logLeveltoTrace - set
python.analysis.logTypeEvaluationTimetotrue - set
python.analysis.typeEvaluationTimeThresholdto500
this will include type evaluation related data to the log. this data is quite large so it should be only included when needed.
[available in 2024.3.100 and after]
- Load the
Pylance extensionby either creating/opening a Python file or folder. - Select
"View: Toggle Output"from the command palette (Ctrl+Shift+P on Windows/Linux, Command+Shift+P on macOS), and wait for the"Python Language Server"output pane to be created, logging the state"Pylance language server XXX (pyright xxx) starting".

- Wait for
VS Codetogo idle(no CPU time on VS Code). - Select
"Pylance: Start profiling"from the command palette. - Reproduce the performance issue.
- when reproducing, please ensure it's as short as possible, containing only the performance issue observed, to avoid unnecessary noise and make identifying issues easier, if not impossible.
- Wait for
VS Codetogo idle(no CPU time on VS Code). - Select
"Pylance: Stop profiling"from the command palette. - Go to the folder the message box showed.

- Select all
*.cpuprofilefiles in the folder. - Provide those files to Pylance, such as attaching them to an issue.
- If you believe it is an indexing issue, one should:
- Start
pylance extensionwith"python.analysis.indexing": falseand - Then perform
steps 1~4, change"python.analysis.indexing": trueinsettings.jsonand save. - Then perform
steps 6~10.
-
"Pylance: Stop profiling"will generatecpuprofilefiles for eachworker thread. Having all of them will help those investigating the performance issue. -
If you encounter an
Out of Memory (OOM)error because the reproduction step is too large, use"python.analysis.nodeExecutable"to allocate more memory to thePylance extension.
This guide explains how to use a SHA value to form a GET request to the GitHub API, retrieve the "content" field, and decode it.
1. Identify the SHA:
- Example SHA:
99787ed45a7080781306fb8204913ca2c5c46f17
2. Form the GET Request:
- Replace
{sha}with the appropriate values. GET https://api.github.com/repos/microsoft/pylance-release/git/blobs/{sha} HTTP/1.1- No Authorization is needed
3. Use a tool like curl, Postman, or VS Code's REST Client extension to send the GET request.
- The response will include a JSON object with a content field
{
"sha": "99787ed45a7080781306fb8204913ca2c5c46f17",
"node_id": "MDQ6QmxvYjI2NTkwMjYyNTo5OTc4N2VkNDVhNzA4MDc4MTMwNmZiODIwNDkxM2NhMmM1YzQ2ZjE3",
"size": 179617,
"url": "https://api.github.com/repos/microsoft/pylance-release/git/blobs/99787ed45a7080781306fb8204913ca2c5c46f17",
"content": THISISENCODEDSTRING
}
4. Decode the Content:
The content field is Base64-encoded. Here is a python script to decode it. or ask your favoriate AI to do so :)
import base64
# Base64 encoded string
encoded_string = """THISISENCODEDSTRING"""
# Decode the base64 string
decoded_bytes = base64.b64decode(encoded_string + '==')
decoded_string = decoded_bytes.decode('utf-8')
print(decoded_string)