Skip to content

Incremental compilation warning "Error finalizing incremental compilation session directory" when building compiler on Windows  #86929

Closed
@rylev

Description

@rylev
Member

When building the compiler on Windows with incremental turned on I often get the following warning:

warning: Error finalizing incremental compilation session directory `\\?\C:\Users\ryanl\Code\rust\build\x86_64-pc-windows-msvc\stage0-rustc\x86_64-pc-windows-msvc\release\incremental\rustc_incremental-3eitboxu59x4j\s-g08srunmh1-1cw7crv-working`: Access is denied. (os error 5)

Compilation continues after this and leads to a successful build.

A similar issue has been reported before (#48700), but that is a panic during compilation of a normal crate.

Activity

added
O-windowsOperating system: Windows
A-incr-compArea: Incremental compilation
C-bugCategory: This is a bug.
on Jul 7, 2021
ChrisDenton

ChrisDenton commented on Jul 7, 2021

@ChrisDenton
Member

Seems to be an fs::rename operation failing? The likely cause would be a file handle that is still open.

Spidy104

Spidy104 commented on Sep 7, 2021

@Spidy104

when will this bug be removed, and will this bug, cause major problems, for creating various stuff, cuz I am new to rust, and I continuously get this error message!

strottos

strottos commented on Sep 12, 2021

@strottos
Contributor

I get this error a lot having just moved to a Windows PC. Whilst everything clearly compiles and runs fine it's very frustrating and can cause real problems. For example, I ran cargo test under the latest tokio and tests fail as such:

ACTUAL OUTPUT:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
warning: Error finalizing incremental compilation session directory `\\?\$WORKSPACE\target\tests\target\debug\incremental\build_script_build-1pup4b7wjll7v\s-g2b8bzyb6c-xy1e9r-working`: Access is denied. (os error 5)

<actual expected output>

Elsewhere I've seen it reported as a VS Code or WSL problem and seen fixes like this proposed: #62031 (comment)
However I'm working entirely without VS Code or WSL and just running cargo build or whatever through Powershell in Windows Terminal.

ZimCodes

ZimCodes commented on Sep 26, 2021

@ZimCodes

I have also received this warning as well. The solution for me was to run cargo clean and then run cargo check (as I wanted to check for more warnings/errors). From here everything was all green.

joelswenddal

joelswenddal commented on Dec 1, 2021

@joelswenddal

I have also received this warning as well. The solution for me was to run cargo clean and then run cargo check (as I wanted to check for more warnings/errors). From here everything was all green.

This resolved it for me as well, moving to wsl 1 on Windows PC. Thanks!

michaelwoerister

michaelwoerister commented on Mar 16, 2022

@michaelwoerister
Member

I'll try to take a look at this.

added a commit that references this issue on Mar 25, 2022

Auto merge of rust-lang#95304 - michaelwoerister:retry-finalize-sessi…

michaelwoerister

michaelwoerister commented on Feb 2, 2023

@michaelwoerister
Member

I haven't seen any reports about this after #95304 was merged. Closing.

added a commit that references this issue on Feb 3, 2023

Rollup merge of rust-lang#107595 - michaelwoerister:retry_proc_macro_…

1594b58
Moth-Tolias

Moth-Tolias commented on Jul 15, 2023

@Moth-Tolias

just encountered this on windows 8. the clean/check thing seems to have worked though.

KOEGlike

KOEGlike commented on Jan 25, 2025

@KOEGlike

just got this on win11 with vscode

brogdonm

brogdonm commented on Apr 24, 2025

@brogdonm

I recently enabled log paths (using gpedit.msc to enable Computer --> Administrative Templates --> System --> Filesystem --> "Enable Win32 Long Paths") in Windows 11 and started getting this error afterwards.

I can typically do a cargo clean and cargo build and it will be fine for a little while and then it starts again.

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

Metadata

Metadata

Labels

A-incr-compArea: Incremental compilationC-bugCategory: This is a bug.O-windowsOperating system: Windows

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @rylev@michaelwoerister@ChrisDenton@Moth-Tolias@strottos

      Issue actions

        Incremental compilation warning "Error finalizing incremental compilation session directory" when building compiler on Windows · Issue #86929 · rust-lang/rust