windmill-labs/windmill · error

C# is not available because the feature is not enabled

Error message

C# is not available because the feature is not enabled

What it means

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.

Source

Thrown at backend/windmill-worker/src/csharp_executor.rs:208

    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,
    _worker_name: &str,
    _w_id: &str,
    _occupancy_metrics: &mut OccupancyMetrics,
) -> error::Result<String> {
    Err(anyhow!("C# is not available because the feature is not enabled").into())
}

#[cfg(feature = "csharp")]
fn gen_cs_proj(
    code: &str,
    job_dir: &str,
    reqs: Vec<(String, Option<String>)>,
    lines_to_remove: Vec<usize>,
) -> anyhow::Result<()> {
    let code = remove_lines_from_text(code, lines_to_remove);

    let pkgs = reqs
        .into_iter()
        .map(|(pkg, vrsion_o)| {
            let version = vrsion_o
                .map(|v| format!("Version=\"{v}\""))
                .unwrap_or("".to_string());
            format!("    <PackageReference Include=\"{pkg}\" {version}/>")

View on GitHub (pinned to e474e8803c)

Solutions

  1. Build/deploy the worker with the csharp feature enabled (cargo build --features csharp or the csharp-enabled worker image)
  2. Route C# jobs to workers that support the language (worker group/tag configuration)
  3. If C# is not needed, disable C# scripts on the instance to avoid queuing jobs on incapable workers
Defensive patterns

Strategy: fallback

Validate before calling

// route before queuing: check worker group features for the job's language
if (script.language === 'csharp' && !workerSupports('csharp')) {
  scheduleOnTaggedWorker('csharp');
}

Try / catch

try {
  await runJob();
} catch (e) {
  if (String(e.message).includes('feature is not enabled')) {
    // redeploy worker with --features csharp or re-tag the job
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling generate_nuget_lockfile (dependency prebuild flow) against a worker built without --features csharp.

Common situations: Deploying the default OSS worker image (no csharp feature) while the instance has C# scripts enabled; after upgrading and losing custom build flags.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/3897d07bab3a7826. Report an issue: GitHub.