windmill-labs/windmill · error

Cannot infer script language from extension '${ext}' (file $

Error message

Cannot infer script language from extension '${ext}' (file ${contentPath}).${hint}
Supported extensions: .ts (bun/deno), .py, .go, .sh, .ps1, .php, .rs, .cs, .nu, .java, .rb, .r, .gql, .playbook.yml, .pg.sql, .my.sql, .bq.sql, .sf.sql, .ms.sql, .odb.sql, .duckdb.sql, and a dbt project folder `<name>__dbt/`

What it means

When syncing/pushing scripts, the CLI infers the Windmill script language from the file extension via inferContentTypeFromFilePath. If the extension is not one of the supported ones (and the path is not a `<name>__dbt/` dbt project folder), it throws with the full list of supported extensions. A bare `.sql` gets an extra hint because SQL requires a dialect suffix.

Source

Thrown at cli/src/utils/script_common.ts:339

  } else if (contentPath.endsWith(".nu")) {
    return "nu";
  } else if (contentPath.endsWith(".java")) {
    return "java";
  } else if (contentPath.endsWith(".rb")) {
    return "ruby";
  } else if (isDbtDescriptorPath(contentPath)) {
    return "dbt";
  } else if (contentPath.endsWith(".r")) {
    return "rlang";
	// for related places search: ADD_NEW_LANG
  } else {
    const ext = contentPath.substring(contentPath.lastIndexOf("."));
    let hint = "";
    if (ext === ".sql") {
      hint =
        "\nBare .sql is ambiguous — use a dialect extension: .pg.sql (postgresql), .my.sql (mysql), .bq.sql (bigquery), .sf.sql (snowflake), .ms.sql (mssql), .odb.sql (oracledb), .duckdb.sql (duckdb)";
    }
    throw new Error(
      `Cannot infer script language from extension '${ext}' (file ${contentPath}).` +
        hint +
        "\nSupported extensions: .ts (bun/deno), .py, .go, .sh, .ps1, .php, .rs, .cs, .nu, .java, .rb, .r, .gql, .playbook.yml, .pg.sql, .my.sql, .bq.sql, .sf.sql, .ms.sql, .odb.sql, .duckdb.sql, and a dbt project folder `<name>__dbt/`"
    );
  }
}

View on GitHub (pinned to e474e8803c)

Solutions

  1. Rename the file to use a supported extension (e.g. `query.sql` → `query.pg.sql` for PostgreSQL)
  2. For TypeScript use `.ts`; pick from the supported list in the error for other languages (.py, .go, .sh, .ps1, .php, .rs, .cs, .nu, .java, .rb, .r, .gql, .playbook.yml, dialect-suffixed .sql)
  3. Structure dbt projects as a folder named `<name>__dbt/` instead of loose files
  4. Exclude non-script files from the sync folder or move them outside it

Example fix

// before
mv query.sql query.pg.sql
// after
wmill sync push   # now infers postgresql dialect
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = [/\.ts$/, /\.py$/, /\.go$/, /\.sh$/, /\.ps1$/, /\.php$/, /\.rs$/, /\.cs$/, /\.nu$/, /\.java$/, /\.rb$/, /\.r$/, /\.gql$/, /\.playbook\.yml$/, /\.(pg|my|bq|sf|ms|odb|duckdb)\.sql$/, /__dbt$/];
const bad = files.filter((f) => !SUPPORTED.some((re) => re.test(f)));
if (bad.length) throw new Error("Unsupported script extensions: " + bad.join(", "));

Type guard

function hasInferableExtension(path: string): boolean {
  return /\.(ts|py|go|sh|ps1|php|rs|cs|nu|java|rb|r|gql|playbook\.yml|(pg|my|bq|sf|ms|odb|duckdb)\.sql)$/.test(path) || /__dbt\/$/.test(path);
}

Try / catch

try {
  await wmillSyncPush();
} catch (e) {
  if (String(e.message).startsWith("Cannot infer script language")) {
    console.error("Rename the offending file to a supported extension (see message).", e.message);
  } else throw e;
}

Prevention

When it happens

Trigger: Running `wmill sync push`/`wmill push` (walk/checkMissingLocks/contentOfScript paths) on a file whose extension is unsupported, misspelled, or ambiguous (e.g. `script.sql`, `foo.txt`, `app.tsx`, `.yml` that is not `.playbook.yml`).

Common situations: Plain `.sql` files written for Postgres/MySQL etc. without a dialect suffix; files with mixed-case or doubled extensions (`.SQL`, `.script.py`); scaffolding a new script with the wrong template; including generated or unrelated files in the sync folder.

Related errors


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