Skip to content

Windows antivirus/EDR issues #20792

Open
Open

Description

@woodruffw

Important

Please read this issue carefully!
TL;DR: Contact your AV/EDR vendor if you're experiencing the kinds of problems described below. Get a ticket number from them, and work with them directly. uv can sometimes work around AV/EDR vendor bugs and excessive locking, but we want those problems reported to the vendor first.


This is a resource for users experiencing issues with uv under the following conditions:

  1. You're using uv on Windows (any version of Windows)
  2. You're using Windows with an antivirus or endpoint detection and response (EDR) product, including (but not limited to) any of the following:
    • Windows Defender
    • BitDefender
    • Avast
    • SecuPrint
    • Netskope
  3. You're experiencing errors on various uv operations (things like uv sync and uv lock), including:
    • The system cannot open the device or file specified. (os error -2147024786)
    • Access is denied. (os error 5)
    • Access is denied. OS Code Error -2147024891
    • uv gets quarantined or deleted entirely by your AV/EDR product

(The list of products/vendors above is not exhaustive, and is supplied for keyword search purposes, not because other vendors are any more or less problematic.)

If you satisfy all of the conditions above (or are seeing errors similar but not identical to (3)), then there is a very good chance that your AV or EDR vendor/product is intefering with uv.

uv makes a best effort to work around many common deficiencies in AV/EDR products, typically by introducing more resiliency and retries. However, these are fundamentally workarounds, and there is a virtually limitless number of ways in which AV/EDR products can violate uv's runtime invariants in ways that are impossible for uv to detect.

Thereforee, before filing a new AV/EDR-related issue with uv, we ask you to do the following:

  1. Please contact your AV/EDR vendor and inform them that their software is causing problems for your workflow. Please do this through your support contract with them.
  2. Please get a confirmation from them that they've received your contact, and that they don't already have a workaround/mitigation/configuration change that your org can apply.
  3. Please share the ticket ID in your new issue so that others who have the same vendor can cross-reference it.

Prior references:

Activity

  1. added
    area:windows
    external
    tracking
    on Jul 29, 2026
  2. pinned this issue on Jul 29, 2026
  3. MasterRoshan commented on Aug 4, 2026

    @MasterRoshan

    I went through the trouble of creating an MRE specifically around trampoline creation. It involves having uv sleep which allows a simulated AV to win a lock on a temporary trampoline .exe

    main...MasterRoshan:uv:main

    • start the av sim
      python scripts\av_sim.py
    • install a package that needs a trampoline
      .\target\debug\uv.exe pip install --reinstall cowsay
    Resolved 1 package in 201ms
    Prepared 1 package in 3ms
    Uninstalled 1 package in 16ms
    ░░░░░░░░░░░░░░░░░░░░ [0/1] Installing wheels...
    [uv-race] sleeping 2000ms with temp trampoline at *****\AppData\Local\Temp\.tmpXSuyBf\uv-trampoline-7928.exe
    error: Failed to install: cowsay-6.1-py3-none-any.whl (cowsay==6.1)
      Caused by: Failed to update Windows PE resources: *****\AppData\Local\Temp\.tmpXSuyBf\uv-trampoline-7928.exe
      Caused by: The system cannot open the device or file specified. (os error -2147024786)
    
  4. mbellgardt commented on Aug 4, 2026

    @mbellgardt

    We are currently facing this issue (BitDefender GravityZone) and it is causing me endless grief, so I decided to look into it a bit. In my understanding, the main cause of the issue is that when uv writes the PE resources to the trampoline it does a write_resource (https://github.com/astral-sh/uv/blob/main/crates/uv-trampoline-builder/src/lib.rs#L479) which does an EndUpdateResourceW (https://github.com/astral-sh/uv/blob/main/crates/uv-trampoline-builder/src/lib.rs#L317). This call re-opens the file for reading and writing without resource sharing. It essentially requests full, exclusive access to an executable file it just wrote. Do you see how AV software might have a problem with that?

    Our IT department will contact BitDefender, but after looking into it, I think this is not an issue to be fixed on the side of the AV vendors, because that software is just doing its job. By creating an executable file and then "trying to prevent other processes from opening it" (I know this is not the intent, but that's how it looks to the AV software) uv is kind of overstaying its welcome.

    This was the first time I looked at the uv source and I'm only a beginner at Rust, so I couldn't really tell you how to solve the issue but I would really appreciate it if someone more knowledgeable could look into it. If I'm completely wrong about this, I'd also appreciate it if you told me why.

    Thank you very much for working on uv which is one of my favorite development tools. You guys rule!

    (Full disclosure: the investigation was performed with the help of AI tools. I did not use AI to write this post and I made sure I understood and validated the findings as per your AI policy)

  5. woodruffw commented on Aug 4, 2026

    @woodruffw
    MemberAuthor

    Hey folks, we realized that this issue was misleading (sorry about that) -- my original goal here was to help people aggregate support IDs for their vendors, not engage in further root causing. In many cases we already know the root cause (AV/EDR vendors taking exclusive locks on files and then holding them for long periods), and we consider it a bug in the vendor's code or a company's profile/configuration rather than uv (since uv is operating only on data/files it controls).

    If you're experiencing a new problem (e.g. with a new vendor or a failure mode not tracked above), please file a new issue and we'll triage it.

  6. locked and limited conversation to collaborators on Aug 4, 2026
  7. zanieb commented on Sep 9, 2026

    @zanieb
    Member

    As of https://github.com/astral-sh/uv/releases/tag/0.12.12, we sign our binaries. This won't immediately resolve issues with antivirus false positives, but should help in the long-term.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:windowsexternaltracking

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions