windmill-labs/windmill · error
File ${path} is encoded as UTF-32 LE, which is not supported
Error message
File ${path} is encoded as UTF-32 LE, which is not supported. Please convert it to UTF-8. What it means
`decodeBufferAsUtf8` in the windmill CLI checks a file's byte-order mark (BOM) before decoding it as UTF-8. Files saved as UTF-32 LE (BOM FF FE 00 00) are rejected outright because the tooling only supports UTF-8 (with optional UTF-8 BOM).
Source
Thrown at cli/src/utils/utils.ts:139
}
export async function generateHash(content: string): Promise<string> {
const messageBuffer = new TextEncoder().encode(content);
return await generateHashFromBuffer(messageBuffer);
}
export async function generateHashFromBuffer(
content: BufferSource
): Promise<string> {
const hashBuffer = await crypto.subtle.digest("SHA-256", content);
return Buffer.from(hashBuffer).toString("hex");
}
function decodeBufferAsUtf8(buf: Buffer, path: string | URL): string {
if (buf.length >= 2) {
if (buf[0] === 0xff && buf[1] === 0xfe) {
if (buf.length >= 4 && buf[2] === 0x00 && buf[3] === 0x00) {
throw new Error(
`File ${path} is encoded as UTF-32 LE, which is not supported. Please convert it to UTF-8.`
);
}
throw new Error(
`File ${path} is encoded as UTF-16 LE, which is not supported. Please convert it to UTF-8.`
);
}
if (buf[0] === 0xfe && buf[1] === 0xff) {
throw new Error(
`File ${path} is encoded as UTF-16 BE, which is not supported. Please convert it to UTF-8.`
);
}
if (buf.length >= 4 && buf[0] === 0x00 && buf[1] === 0x00 && buf[2] === 0xfe && buf[3] === 0xff) {
throw new Error(
`File ${path} is encoded as UTF-32 BE, which is not supported. Please convert it to UTF-8.`
);
}
}View on GitHub (pinned to e474e8803c)
Solutions
- Re-save the file as UTF-8 (VS Code: 'Save with Encoding' → UTF-8)
- Convert in place: `iconv -f UTF-32LE -t UTF-8 file > file.tmp && mv file.tmp file`
- On PowerShell: `Get-Content file | Set-Content -Encoding utf8 file`
Example fix
// before (PowerShell) "content" | Out-File script.yaml -Encoding UTF32 // after "content" | Out-File script.yaml -Encoding utf8BOM
Defensive patterns
Strategy: validation
Validate before calling
const fs = require('fs');
function assertNotUtf32Le(path) {
const b = fs.readFileSync(path).subarray(0, 4);
if (b[0] === 0xff && b[1] === 0xfe && b[2] === 0x00 && b[3] === 0x00)
throw new Error(`${path} is UTF-32 LE; convert to UTF-8 first`);
} Type guard
function isUtf32Le(buf) {
return buf.length >= 4 && buf[0] === 0xff && buf[1] === 0xfe && buf[2] === 0x00 && buf[3] === 0x00;
} Try / catch
try {
const content = await readTextFile(path);
} catch (e) {
if (String(e.message).includes('UTF-32 LE')) console.error('Convert the file to UTF-8 (iconv -f UTF-32LE -t UTF-8).');
else throw e;
} Prevention
- Configure editors and shell redirections to write UTF-8 (PowerShell: -Encoding utf8)
- Check file encodings with `file <path>` before feeding files to the CLI
- Avoid legacy Windows 'Unicode'/'UTF-32' save options in Notepad/PowerShell 5
When it happens
Trigger: Reading any file via `readTextFile`/`readTextFileSync` (e.g. a YAML script or flow definition) whose first bytes are FF FE 00 00.
Common situations: Files created or re-saved by Windows Notepad or PowerShell (`Out-File`) writing UTF-32; files converted between encodings incorrectly.
Related errors
- File ${path} is encoded as UTF-32 BE, which is not supported
- File ${path} is encoded as UTF-16 LE, which is not supported
- File ${path} is encoded as UTF-16 BE, which is not supported
- Error parsing yaml ${path}
- Failed to load S3 file: ${response.status} ${response.status
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/c571e36ae75b3d87.
Report an issue: GitHub.