windmill-labs/windmill · error

Error setting Ruby as language: {e}

Error message

Error setting Ruby as language: {e}

What it means

`parse_ruby_sig_meta` configures a tree-sitter parser with the Ruby grammar. `parser.set_language` returns Err when the grammar's ABI version is incompatible with the tree-sitter runtime; the library surfaces it as "Error setting Ruby as language: {e}".

Source

Thrown at backend/parsers/windmill-parser-ruby/src/lib.rs:21

#[cfg(target_arch = "wasm32")]
pub mod wasm_libc;

use anyhow::anyhow;
use anyhow::bail;
use regex::Regex;
use serde_json::Value;
use tree_sitter::Node;
use tree_sitter::Range;
use windmill_parser::json_to_typ;
use windmill_parser::Arg;
use windmill_parser::MainArgSignature;

pub fn parse_ruby_sig_meta(code: &str) -> anyhow::Result<MainArgSignature> {
    let mut parser = tree_sitter::Parser::new();
    let language = tree_sitter_ruby::LANGUAGE;
    parser
        .set_language(&language.into())
        .map_err(|e| anyhow!("Error setting Ruby as language: {e}"))?;

    // Parse code
    let tree = parser
        .parse(code, None)
        .ok_or(anyhow!("Failed to parse code"))?;
    let root_node = tree.root_node();

    root_node.clone().to_string();
    // Traverse the AST to find the Main method signature
    let args = find_main_signature(root_node, code)?;
    let auto_kind = if args.is_none() {
        Some("lib".to_string())
    } else {
        None
    };

    let main_sig = MainArgSignature {
        star_args: false,

View on GitHub (pinned to e474e8803c)

Solutions

  1. Check `cargo tree -i tree-sitter` for multiple versions in backend/parsers/windmill-parser-ruby
  2. Bump `tree-sitter-ruby` to match the tree-sitter runtime generation
  3. Pin both crates to compatible versions in the workspace and regenerate the lockfile
  4. Rebuild clean (`cargo clean -p windmill-parser-ruby`) if the error persists after version alignment

Example fix

// before (Cargo.toml)
tree-sitter = "0.20"
tree-sitter-ruby = "0.23"
// after
tree-sitter = "0.25"
tree-sitter-ruby = "0.23"  # updated to ABI compatible with 0.25
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify single resolved tree-sitter version in the build:
// cargo tree -i tree-sitter --package windmill-parser-ruby

Try / catch

match parse_ruby_sig_meta(code) {
    Ok(sig) => sig,
    Err(e) if e.to_string().contains("Error setting Ruby as language") => {
        // dependency/ABI issue: surface as build-environment error
        Err(anyhow!("Ruby grammar incompatible with tree-sitter runtime: {e}"))
    }
    Err(e) => Err(e),
}

Prevention

When it happens

Trigger: Any call to `parse_ruby_sig_meta` (exposed through `parse_ruby_signature`) where `tree_sitter_ruby::LANGUAGE.into()` is rejected due to tree-sitter runtime/grammar version mismatch.

Common situations: `tree-sitter` crate upgraded without upgrading `tree-sitter-ruby` (or the reverse); a lockfile re-resolve pulling mismatched versions; vendored grammar built with an older tree-sitter CLI.

Related errors


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