Kong/insomnia · error

Failed to read directory: ${err}

Error message

Failed to read directory: ${err}

What it means

Error "Failed to read directory: ${err}" thrown in Kong/insomnia.

Source

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

  return sanitizedConfig;
};

const readDir = async (_: unknown, options: { path: string }) => {
  try {
    const files = await fs.promises.readdir(options.path);
    return files
      .map(file => {
        const filePath = path.join(options.path, file);
        return {
          type: fs.statSync(filePath).isDirectory() ? 'directory' : fs.statSync(filePath).isFile() ? 'file' : 'other',
          name: file,
          path: filePath,
        };
      })
      .filter(file => file.type !== 'other');
  } catch (err) {
    throw new Error(`Failed to read directory: ${err}`);
  }
};

const writeResponseBodyToFile = async (
  _: unknown,
  options: { sourcePath: string; destinationPath: string; bodyCompression?: 'zip' | null },
) => {
  // Validate sourcePath is within the expected responses directory to prevent a
  // compromised renderer from using this handler to read arbitrary files on disk.
  const userdataDirectory = process.env.INSOMNIA_DATA_PATH || app.getPath('userData');
  const allowedResponsesDir = path.join(userdataDirectory, 'responses');
  const resolvedSource = path.resolve(options.sourcePath);
  if (!resolvedSource.startsWith(allowedResponsesDir + path.sep) || !resolvedSource.endsWith('.response')) {
    throw new Error(
      'writeResponseBodyToFile: sourcePath is outside the allowed responses directory or does not end in .response',
    );
  }

View on GitHub (pinned to d9bb2b0142)

When it happens

Trigger: Thrown at packages/insomnia/src/main/ipc/main.ts:145 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/bcf55a7f15195a6b. Report an issue: GitHub.