Kong/insomnia · error · InsoError

Failed to read "${filePath}"

Error message

Failed to read "${filePath}"

What it means

Error "Failed to read "${filePath}"" thrown in Kong/insomnia.

Source

Thrown at packages/insomnia-inso/src/commands/lint-specification.ts:80

export const safeRefResolver = new Resolver({
  resolvers: {
    http: safeHttpResolver,
    https: safeHttpResolver,
  },
});

export const getRuleSetFileFromFolderByFilename = async (filePath: string) => {
  try {
    const filesInSpecFolder = await fs.promises.readdir(path.dirname(filePath));
    const rulesetFileName = filesInSpecFolder.find(file => file.startsWith('.spectral'));
    if (rulesetFileName) {
      logger.trace(`Loading ruleset from \`${rulesetFileName}\``);
      return path.resolve(path.dirname(filePath), rulesetFileName);
    }
    logger.info(`Using ruleset: oas, see ${oas.documentationUrl}`);
    return;
  } catch (error) {
    throw new InsoError(`Failed to read "${filePath}"`, error);
  }
};
export async function lintSpecification({
  specContent,
  rulesetFileName,
}: {
  specContent: string;
  rulesetFileName?: string;
}) {
  const spectral = new Spectral({ resolver: safeRefResolver });
  // Use custom ruleset if present
  let ruleset = oas;
  try {
    if (rulesetFileName) {
      // Step 1: flatten local extends and validate remote URLs (SSRF + disallowed keys).
      const bundled = await bundleSpectralRuleset(rulesetFileName);
      // Step 2: fetch + fully inline remote extends so bundleAndLoadRuleset has nothing to fetch,
      // closing the validate-then-use race.

View on GitHub (pinned to d9bb2b0142)

When it happens

Trigger: Thrown at packages/insomnia-inso/src/commands/lint-specification.ts:80 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/88647ea98f01651a. Report an issue: GitHub.