Uncertain how to get this to 100% repro. It seems to be fairly uncommon to get into this state, but once it's in it, it stays this way until manual intervention repairs or works around the issue.
FWIW, I've only seen this happen on developer workstations, not on headless build servers.
C:\CW\CWShared\ErrorReporting\Shared>.paket\paket.exe restore -v
Checking Paket version (version 5.186.0 requested)...
Paket.exe 5.186.0 is up to date.
Paket version 5.186.0
found: C:\CW\CWShared\ErrorReporting\Shared\paket.dependencies
- C:\CW\CWShared\ErrorReporting\Shared\.paket\Paket.Restore.targets already up-to-date
Parsing C:\CW\CWShared\ErrorReporting\Shared\paket.dependencies
- C:\CW\CWShared\ErrorReporting\Shared\src\WTG.ErrorReporting\obj\WTG.ErrorReporting.csproj.NuGet.Config already up-to-date
- C:\CW\CWShared\ErrorReporting\Shared\src\WTG.ErrorReporting\obj\WTG.ErrorReporting.csproj.net46.paket.resolved created
- C:\CW\CWShared\ErrorReporting\Shared\src\WTG.ErrorReporting\obj\WTG.ErrorReporting.csproj.netstandard2.0.paket.resolved created
- C:\CW\CWShared\ErrorReporting\Shared\src\WTG.ErrorReporting\obj\WTG.ErrorReporting.csproj.paket.props already up-to-date
Failed to save cached file C:\CW\CWShared\ErrorReporting\Shared\src\WTG.ErrorReporting\obj\WTG.ErrorReporting.csproj.paket.references.cached. Retry. Message: Access to the path 'C:\CW\CWShared\ErrorReporting\Shared\src\WTG.ErrorReporting\obj\WTG.ErrorReporting.csproj.paket.references.cached' is denied.
Failed to save cached file C:\CW\CWShared\ErrorReporting\Shared\src\WTG.ErrorReporting\obj\WTG.ErrorReporting.csproj.paket.references.cached. Retry. Message: Access to the path 'C:\CW\CWShared\ErrorReporting\Shared\src\WTG.ErrorReporting\obj\WTG.ErrorReporting.csproj.paket.references.cached' is denied.
Failed to save cached file C:\CW\CWShared\ErrorReporting\Shared\src\WTG.ErrorReporting\obj\WTG.ErrorReporting.csproj.paket.references.cached. Retry. Message: Access to the path 'C:\CW\CWShared\ErrorReporting\Shared\src\WTG.ErrorReporting\obj\WTG.ErrorReporting.csproj.paket.references.cached' is denied.
Failed to save cached file C:\CW\CWShared\ErrorReporting\Shared\src\WTG.ErrorReporting\obj\WTG.ErrorReporting.csproj.paket.references.cached. Retry. Message: Access to the path 'C:\CW\CWShared\ErrorReporting\Shared\src\WTG.ErrorReporting\obj\WTG.ErrorReporting.csproj.paket.references.cached' is denied.
Failed to save cached file C:\CW\CWShared\ErrorReporting\Shared\src\WTG.ErrorReporting\obj\WTG.ErrorReporting.csproj.paket.references.cached. Retry. Message: Access to the path 'C:\CW\CWShared\ErrorReporting\Shared\src\WTG.ErrorReporting\obj\WTG.ErrorReporting.csproj.paket.references.cached' is denied.
Performance:
- Runtime: 1 second
Paket failed with
-> UnauthorizedAccessException: Access to the path 'C:\CW\CWShared\ErrorReporting\Shared\src\WTG.ErrorReporting\obj\WTG.ErrorReporting.csproj.paket.references.cached' is denied.
StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at Paket.RestoreProcess.loop@478-18(ReferencesFile referencesFile, FileInfo paketCachedReferencesFileName, Int32 trials)
at Paket.RestoreProcess.loop@478-18(ReferencesFile referencesFile, FileInfo paketCachedReferencesFileName, Int32 trials)
at Paket.RestoreProcess.loop@478-18(ReferencesFile referencesFile, FileInfo paketCachedReferencesFileName, Int32 trials)
at Paket.RestoreProcess.loop@478-18(ReferencesFile referencesFile, FileInfo paketCachedReferencesFileName, Int32 trials)
at Paket.RestoreProcess.loop@478-18(ReferencesFile referencesFile, FileInfo paketCachedReferencesFileName, Int32 trials)
at Paket.RestoreProcess.loop@478-18(ReferencesFile referencesFile, FileInfo paketCachedReferencesFileName, Int32 trials)
at Paket.RestoreProcess.createProjectReferencesFiles(LockFile lockFile, ProjectFile projectFile, ReferencesFile referencesFile, Lazy`1 resolved, FSharpMap`2 groups, FSharpOption`1 targetFrameworks)
at Paket.RestoreProcess.RestoreNewSdkProject@531.Invoke(Unit unitVar0)
at Paket.Utils.RunInLockedAccessMode[a](String lockedFolder, FSharpFunc`2 action)
at Paket.RestoreProcess.Restore$cont@591(FSharpOption`1 targetFrameworks, FSharpList`1 referencesFileNames, FSharpOption`1 projectFile, Boolean ignoreChecks, FSharpOption`1 group, Boolean force, Boolean failOnChecks, String dependenciesFileName, FileInfo lockFileName, String root, Boolean isFullRestore, Lazy`1 lockFile, Lazy`1 localFile, Boolean hasLocalFile, Unit unitVar)
at Paket.RestoreProcess.Restore(String dependenciesFileName, FSharpOption`1 projectFile, Boolean force, FSharpOption`1 group, FSharpList`1 referencesFileNames, Boolean ignoreChecks, Boolean failOnChecks, FSharpOption`1 targetFrameworks)
at Paket.Program.handleCommand@825-14.Invoke(ParseResults`1 results)
at Paket.Program.processWithValidationEx$cont@42[a](Boolean silent, FSharpFunc`2 commandF, a result, Unit unitVar)
at Paket.Program.processWithValidation[T](Boolean silent, FSharpFunc`2 validateF, FSharpFunc`2 commandF, ParseResults`1 result)
at Paket.Program.handleCommand(Boolean silent, Command command)
at Paket.Program.main()
The cause is likely to be that the file is marked read-only at the filesystem level:
Description
When running
.paket\paket.exe restore, sometimes it fails with an error.Repro steps
Uncertain how to get this to 100% repro. It seems to be fairly uncommon to get into this state, but once it's in it, it stays this way until manual intervention repairs or works around the issue.
FWIW, I've only seen this happen on developer workstations, not on headless build servers.
Expected behavior
paket.exe restorerestores packages without errorActual behavior
Error message, as below:
The cause is likely to be that the file is marked read-only at the filesystem level:
Known workarounds
objfolders and re-run Paket.