{"record":{"id":"9d7e65c835c7269f","repo":"windmill-labs/windmill","slug":"error-erasing-nuget-config","errorCode":null,"errorMessage":"Error erasing nuget.config: {}","messagePattern":"Error erasing nuget\\.config: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"backend/windmill-worker/src/csharp_executor.rs","lineNumber":185,"sourceCode":"        conn,\n        mem_peak,\n        canceled_by,\n        gen_lockfile_process,\n        false,\n        worker_name,\n        w_id,\n        \"dotnet restore\",\n        None,\n        false,\n        &mut Some(occupancy_metrics),\n        None,\n        None,\n    )\n    .await?;\n\n    if let Err(e) = std::fs::remove_file(Path::new(job_dir).join(\"nuget.config\")) {\n        if e.kind() != io::ErrorKind::NotFound {\n            Err(anyhow!(\"Error erasing nuget.config: {}\", e))?;\n        }\n    }\n\n    let path_lock = format!(\"{job_dir}/packages.lock.json\");\n    let mut file = File::open(path_lock).await?;\n    let mut req_content = String::new();\n    file.read_to_string(&mut req_content).await?;\n    Ok(req_content)\n}\n\n#[cfg(not(feature = \"csharp\"))]\npub async fn generate_nuget_lockfile(\n    _job_id: &Uuid,\n    _code: &str,\n    _mem_peak: &mut i32,\n    _canceled_by: &mut Option<CanceledBy>,\n    _job_dir: &str,\n    _conn: &Connection,","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-worker/src/csharp_executor.rs#L167-L203","documentation":"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.","triggerScenarios":"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.","commonSituations":"Windows/CI filesystems holding locks on nuget.config; job directory permissions altered by prior docker/nsjail runs; immutable attribute set.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"const fs = require('fs');\ntry { fs.accessSync(jobDir + '/nuget.config', fs.constants.W_OK); } catch (e) {\n  console.warn('nuget.config not writable by worker:', e.message);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await prebuild(job);\n} catch (e) {\n  if (String(e.message).includes('Error erasing nuget.config')) {\n    // retry once on a clean job dir after releasing file locks\n  }\n  throw e;\n}","preventionTips":["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"],"tags":["filesystem","csharp","nuget","cleanup"],"backgroundTag":"file-permission-denied","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}