windmill-labs/windmill · error

Invalid language: ${language}

Error message

Invalid language: ${language}

What it means

The local schema-inference code path in metadata.ts dispatches on the script's `language` field to pick a WASM parser (parse_python, parse_bash, parse_dbt, ...). If the language string matches none of the known branches, it throws a plain Error('Invalid language: <language>'). This guards the CLI against unknown or misspelled language values coming from a script's metadata/frontmatter.

Source

Thrown at cli/src/utils/metadata.ts:949

    inferedSchema = JSON.parse(parse_nu(content));
  } else if (language === "ansible") {
    const { parse_ansible } = await loadParser("windmill-parser-wasm-yaml");
    inferedSchema = JSON.parse(parse_ansible(content));
  } else if (language === "java") {
    const { parse_java } = await loadParser("windmill-parser-wasm-java");
    inferedSchema = JSON.parse(parse_java(content));
  } else if (language === "ruby") {
    const { parse_ruby } = await loadParser("windmill-parser-wasm-ruby");
    inferedSchema = JSON.parse(parse_ruby(content));
  } else if (language === "rlang") {
    const { parse_r } = await loadParser("windmill-parser-wasm-r");
    inferedSchema = JSON.parse(parse_r(content));
  } else if (language === "dbt") {
    const { parse_dbt } = await loadParser("windmill-parser-wasm-yaml");
    inferedSchema = JSON.parse(parse_dbt(content));
    // for related places search: ADD_NEW_LANG
  } else {
    throw new Error("Invalid language: " + language);
  }
  if (inferedSchema.type == "Invalid") {
    log.info(
      colors.yellow(
        `Script ${path} invalid, it cannot be parsed to infer schema.`
      )
    );
    return {
      schema: defaultScriptMetadata().schema,
      has_preprocessor: false,
      auto_kind: undefined,
    };
  }

  if (!currentSchema) {
    currentSchema = {};
  }
  currentSchema.required = [];

View on GitHub (pinned to e474e8803c)

Solutions

  1. Check the exact language value shown in the message and correct the `language` field in the script's metadata/frontmatter to a supported value (python, bun, deno, go, bash, powershell, php, rust, csharp, nu, ansible, java, ruby, rlang, dbt, etc.)
  2. Update the wmill CLI to the latest version — a language unknown to your CLI may be supported in newer releases
  3. Ensure the language is actually set (not null/empty) in the script metadata or where the function is invoked programmatically
  4. If you are adding a genuinely new language, implement its parser branch at the ADD_NEW_LANG marker in cli/src/utils/metadata.ts

Example fix

// before: script frontmatter with invalid language
# language: pyhton
// after: corrected language
# language: python3 -> use supported value
# language: python
Defensive patterns

Strategy: validation

Validate before calling

// validate language before invoking schema inference
const SUPPORTED_LANGS = new Set([
  "python","bun","deno","go","bash","powershell","php","rust","csharp",
  "nu","ansible","java","ruby","rlang","dbt","mssql","postgresql","duckdb","graphql",
]);
if (!SUPPORTED_LANGS.has(language)) {
  throw new Error(`Language '${language}' not supported by this CLI; check script frontmatter or update windmill-cli`);
}

Type guard

function isSupportedLanguage(
  language: unknown,
): language is ScriptLanguage {
  return typeof language === "string" && language.length > 0 && language in languageNeedsLockMap;
}

Try / catch

try {
  const schema = await getScriptMetadata(content, path, language);
} catch (e) {
  if (e instanceof Error && e.message.startsWith("Invalid language:")) {
    log.error(`${e.message} — fix the 'language' field in the script frontmatter, or update the wmill CLI`);
  } else throw e;
}

Prevention

When it happens

Trigger: Calling the schema-inference function (the ADD_NEW_LANG dispatch chain) with a language value outside the supported set — e.g. a misspelled language in a script's YAML frontmatter, a language added by a newer Windmill server but not yet supported by the installed CLI, or a null/undefined/empty language passed programmatically.

Common situations: Typo in a script's `language:` frontmatter field (e.g. `typescript` vs the expected value, `pyhton`); hand-edited script metadata; new Windmill language released after your CLI version; scripts synced from an instance running a newer version than the CLI.

Related errors


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