{"record":{"id":"3897d07bab3a7826","repo":"windmill-labs/windmill","slug":"c-is-not-available-because-the-feature-is-not-ena","errorCode":null,"errorMessage":"C# is not available because the feature is not enabled","messagePattern":"C# is not available because the feature is not enabled","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/windmill-worker/src/csharp_executor.rs","lineNumber":208,"sourceCode":"    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,\n    _worker_name: &str,\n    _w_id: &str,\n    _occupancy_metrics: &mut OccupancyMetrics,\n) -> error::Result<String> {\n    Err(anyhow!(\"C# is not available because the feature is not enabled\").into())\n}\n\n#[cfg(feature = \"csharp\")]\nfn gen_cs_proj(\n    code: &str,\n    job_dir: &str,\n    reqs: Vec<(String, Option<String>)>,\n    lines_to_remove: Vec<usize>,\n) -> anyhow::Result<()> {\n    let code = remove_lines_from_text(code, lines_to_remove);\n\n    let pkgs = reqs\n        .into_iter()\n        .map(|(pkg, vrsion_o)| {\n            let version = vrsion_o\n                .map(|v| format!(\"Version=\\\"{v}\\\"\"))\n                .unwrap_or(\"\".to_string());\n            format!(\"    <PackageReference Include=\\\"{pkg}\\\" {version}/>\")","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-worker/src/csharp_executor.rs#L190-L226","documentation":"Returned by the non-csharp build of generate_nuget_lockfile (cfg(not(feature = \"csharp\"))): the worker binary was compiled without the csharp cargo feature, so C# dependency locking cannot run. It is a compile-time capability error, not a user-code error — every C# job landing on such a worker fails this way, and redeploying with the feature enabled is the only fix.","triggerScenarios":"Calling generate_nuget_lockfile (dependency prebuild flow) against a worker built without --features csharp.","commonSituations":"Deploying the default OSS worker image (no csharp feature) while the instance has C# scripts enabled; after upgrading and losing custom build flags.","solutions":["Build/deploy the worker with the csharp feature enabled (cargo build --features csharp or the csharp-enabled worker image)","Route C# jobs to workers that support the language (worker group/tag configuration)","If C# is not needed, disable C# scripts on the instance to avoid queuing jobs on incapable workers"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// route before queuing: check worker group features for the job's language\nif (script.language === 'csharp' && !workerSupports('csharp')) {\n  scheduleOnTaggedWorker('csharp');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runJob();\n} catch (e) {\n  if (String(e.message).includes('feature is not enabled')) {\n    // redeploy worker with --features csharp or re-tag the job\n  }\n  throw e;\n}","preventionTips":["Document required cargo features per worker group","Verify language support after worker upgrades","Pin C# jobs to csharp-capable worker tags"],"tags":["csharp","feature-flag","worker-config"],"backgroundTag":"feature-not-enabled","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"}