{"record":{"id":"f02289c5bce0ec80","repo":"windmill-labs/windmill","slug":"cannot-infer-script-language-from-extension-ext","errorCode":null,"errorMessage":"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/`","messagePattern":"Cannot infer script language from extension '(.+?)' \\(file (.+?)\\)\\.(.+?)\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/`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/utils/script_common.ts","lineNumber":339,"sourceCode":"  } else if (contentPath.endsWith(\".nu\")) {\n    return \"nu\";\n  } else if (contentPath.endsWith(\".java\")) {\n    return \"java\";\n  } else if (contentPath.endsWith(\".rb\")) {\n    return \"ruby\";\n  } else if (isDbtDescriptorPath(contentPath)) {\n    return \"dbt\";\n  } else if (contentPath.endsWith(\".r\")) {\n    return \"rlang\";\n\t// for related places search: ADD_NEW_LANG\n  } else {\n    const ext = contentPath.substring(contentPath.lastIndexOf(\".\"));\n    let hint = \"\";\n    if (ext === \".sql\") {\n      hint =\n        \"\\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)\";\n    }\n    throw new Error(\n      `Cannot infer script language from extension '${ext}' (file ${contentPath}).` +\n        hint +\n        \"\\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/`\"\n    );\n  }\n}\n","sourceCodeStart":321,"sourceCodeEnd":346,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/utils/script_common.ts#L321-L346","documentation":"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.","triggerScenarios":"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`).","commonSituations":"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.","solutions":["Rename the file to use a supported extension (e.g. `query.sql` → `query.pg.sql` for PostgreSQL)","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)","Structure dbt projects as a folder named `<name>__dbt/` instead of loose files","Exclude non-script files from the sync folder or move them outside it"],"exampleFix":"// before\nmv query.sql query.pg.sql\n// after\nwmill sync push   # now infers postgresql dialect","handlingStrategy":"validation","validationCode":"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$/];\nconst bad = files.filter((f) => !SUPPORTED.some((re) => re.test(f)));\nif (bad.length) throw new Error(\"Unsupported script extensions: \" + bad.join(\", \"));","typeGuard":"function hasInferableExtension(path: string): boolean {\n  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);\n}","tryCatchPattern":"try {\n  await wmillSyncPush();\n} catch (e) {\n  if (String(e.message).startsWith(\"Cannot infer script language\")) {\n    console.error(\"Rename the offending file to a supported extension (see message).\", e.message);\n  } else throw e;\n}","preventionTips":["Name SQL files with a dialect suffix (.pg.sql, .my.sql, ...) — never bare .sql","Lint the sync folder for unsupported extensions before running wmill sync","Use the CLI's script templates/scaffolding so files get correct extensions from the start","Keep generated or unrelated files out of the synced directory"],"tags":["cli","sync","file-extension","validation"],"backgroundTag":"unsupported-file-extension","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"}