windmill-labs/windmill · warning
Error erasing nuget.config: {}
Error message
Error erasing nuget.config: {} What it means
generate_nuget_lockfile removes the temporary nuget.config it generated before restoring the user's config flow. A deletion failure other than NotFound (permissions, file locked, directory issue) surfaces as this error.
Source
Thrown at backend/windmill-worker/src/csharp_executor.rs:185
conn,
mem_peak,
canceled_by,
gen_lockfile_process,
false,
worker_name,
w_id,
"dotnet restore",
None,
false,
&mut Some(occupancy_metrics),
None,
None,
)
.await?;
if let Err(e) = std::fs::remove_file(Path::new(job_dir).join("nuget.config")) {
if e.kind() != io::ErrorKind::NotFound {
Err(anyhow!("Error erasing nuget.config: {}", e))?;
}
}
let path_lock = format!("{job_dir}/packages.lock.json");
let mut file = File::open(path_lock).await?;
let mut req_content = String::new();
file.read_to_string(&mut req_content).await?;
Ok(req_content)
}
#[cfg(not(feature = "csharp"))]
pub async fn generate_nuget_lockfile(
_job_id: &Uuid,
_code: &str,
_mem_peak: &mut i32,
_canceled_by: &mut Option<CanceledBy>,
_job_dir: &str,
_conn: &Connection,View on GitHub (pinned to e474e8803c)
Solutions
- Check permissions on job_dir/nuget.config and delete it manually if the worker lacks rights
- Ensure no other process (IDE, dotnet restore, container) holds the file open during prebuild
- Re-run the job on a clean worker so a fresh job_dir is created
- If persistent, inspect the underlying io error kind in logs to target the exact filesystem cause
Defensive patterns
Strategy: retry
Validate before calling
const fs = require('fs');
try { fs.accessSync(jobDir + '/nuget.config', fs.constants.W_OK); } catch (e) {
console.warn('nuget.config not writable by worker:', e.message);
} Try / catch
try {
await prebuild(job);
} catch (e) {
if (String(e.message).includes('Error erasing nuget.config')) {
// retry once on a clean job dir after releasing file locks
}
throw e;
} Prevention
- Don't make generated files read-only during builds
- Ensure no concurrent process locks job_dir on Windows
- Run builds with a user owning the job dir
When it happens
Trigger: During C# dependency prebuild, std::fs::remove_file on {job_dir}/nuget.config fails with e.g. PermissionDenied because the file was made read-only or the job dir ownership changed.
Common situations: Windows/CI filesystems holding locks on nuget.config; job directory permissions altered by prior docker/nsjail runs; immutable attribute set.
Related errors
- File not found: ${filePath}
- Workspace folder not found, are you in the right directory?
- Directory not found: ${targetDirectory}
- Path is not a directory: ${targetDirectory}
- file path must refer to a file.
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/9d7e65c835c7269f.
Report an issue: GitHub.