{"record":{"id":"72812791b679c648","repo":"windmill-labs/windmill","slug":"invalid-language-language-728127","errorCode":null,"errorMessage":"Invalid language: ${language}","messagePattern":"Invalid language: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/utils/metadata.ts","lineNumber":949,"sourceCode":"    inferedSchema = JSON.parse(parse_nu(content));\n  } else if (language === \"ansible\") {\n    const { parse_ansible } = await loadParser(\"windmill-parser-wasm-yaml\");\n    inferedSchema = JSON.parse(parse_ansible(content));\n  } else if (language === \"java\") {\n    const { parse_java } = await loadParser(\"windmill-parser-wasm-java\");\n    inferedSchema = JSON.parse(parse_java(content));\n  } else if (language === \"ruby\") {\n    const { parse_ruby } = await loadParser(\"windmill-parser-wasm-ruby\");\n    inferedSchema = JSON.parse(parse_ruby(content));\n  } else if (language === \"rlang\") {\n    const { parse_r } = await loadParser(\"windmill-parser-wasm-r\");\n    inferedSchema = JSON.parse(parse_r(content));\n  } else if (language === \"dbt\") {\n    const { parse_dbt } = await loadParser(\"windmill-parser-wasm-yaml\");\n    inferedSchema = JSON.parse(parse_dbt(content));\n    // for related places search: ADD_NEW_LANG\n  } else {\n    throw new Error(\"Invalid language: \" + language);\n  }\n  if (inferedSchema.type == \"Invalid\") {\n    log.info(\n      colors.yellow(\n        `Script ${path} invalid, it cannot be parsed to infer schema.`\n      )\n    );\n    return {\n      schema: defaultScriptMetadata().schema,\n      has_preprocessor: false,\n      auto_kind: undefined,\n    };\n  }\n\n  if (!currentSchema) {\n    currentSchema = {};\n  }\n  currentSchema.required = [];","sourceCodeStart":931,"sourceCodeEnd":967,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/utils/metadata.ts#L931-L967","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.)","Update the wmill CLI to the latest version — a language unknown to your CLI may be supported in newer releases","Ensure the language is actually set (not null/empty) in the script metadata or where the function is invoked programmatically","If you are adding a genuinely new language, implement its parser branch at the ADD_NEW_LANG marker in cli/src/utils/metadata.ts"],"exampleFix":"// before: script frontmatter with invalid language\n# language: pyhton\n// after: corrected language\n# language: python3 -> use supported value\n# language: python","handlingStrategy":"validation","validationCode":"// validate language before invoking schema inference\nconst SUPPORTED_LANGS = new Set([\n  \"python\",\"bun\",\"deno\",\"go\",\"bash\",\"powershell\",\"php\",\"rust\",\"csharp\",\n  \"nu\",\"ansible\",\"java\",\"ruby\",\"rlang\",\"dbt\",\"mssql\",\"postgresql\",\"duckdb\",\"graphql\",\n]);\nif (!SUPPORTED_LANGS.has(language)) {\n  throw new Error(`Language '${language}' not supported by this CLI; check script frontmatter or update windmill-cli`);\n}","typeGuard":"function isSupportedLanguage(\n  language: unknown,\n): language is ScriptLanguage {\n  return typeof language === \"string\" && language.length > 0 && language in languageNeedsLockMap;\n}","tryCatchPattern":"try {\n  const schema = await getScriptMetadata(content, path, language);\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith(\"Invalid language:\")) {\n    log.error(`${e.message} — fix the 'language' field in the script frontmatter, or update the wmill CLI`);\n  } else throw e;\n}","preventionTips":["Verify the `language` frontmatter field against the CLI's supported list before syncing scripts","Keep the wmill CLI updated when your Windmill instance gains new languages","Never hand-edit script metadata language fields without checking spelling","Search the source for ADD_NEW_LANG in cli/src/utils/metadata.ts to see the full supported-language dispatch table","Validate language programmatically (type guard / allowlist) before calling schema inference"],"tags":["validation","cli","metadata","language"],"backgroundTag":"invalid-language","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"}