Kong/insomnia · error

Unsupported encoding: ${encoding} to read file

Error message

Unsupported encoding: ${encoding} to read file

What it means

Error "Unsupported encoding: ${encoding} to read file" thrown in Kong/insomnia.

Source

Thrown at packages/insomnia/src/main/ipc/main.ts:622

  });
  ipcMainHandle('secureReadFile', async (_, options: { path: string; encoding?: string }) => {
    return secureReadFile(options.path);
  });
  ipcMainHandle('insecureReadFileWithEncoding', async (_, options: { path: string; encoding: string }) => {
    try {
      const contentBuffer = await insecureReadFileWithEncoding(options.path);
      if (typeof contentBuffer === 'string') {
        return { content: contentBuffer, encoding: 'utf8' };
      }

      const encoding = options.encoding || (await chardet.detectFile(options.path));

      if (encoding) {
        if (iconv.encodingExists(encoding)) {
          const content = iconv.decode(contentBuffer, encoding);
          return { content, encoding };
        }
        throw new Error(`Unsupported encoding: ${encoding} to read file`);
      }
      return {
        content: iconv.decode(contentBuffer, 'utf8'),
        encoding: 'utf8',
      };
    } catch (err) {
      return { content: '', encoding: '', error: err };
    }
  });

  ipcMainHandle('readDir', readDir);

  ipcMainHandle('readOrCreateDataDir', async (_, options: { folder: string }) => {
    const folderPath = path.join(app.getPath('userData'), options.folder);
    mkdirSync(folderPath, { recursive: true });
    try {
      return await readDir(_, { path: folderPath });
    } catch {

View on GitHub (pinned to d9bb2b0142)

When it happens

Trigger: Thrown at packages/insomnia/src/main/ipc/main.ts:622 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Kong/insomnia@d9bb2b0142 (2026-08-26). Data as JSON: /api/errors/da7ef9dd830d88b0. Report an issue: GitHub.