usebruno/bruno · error · Error

Failed to parse content as JSON or YAML

Error message

Failed to parse content as JSON or YAML

What it means

Error "Failed to parse content as JSON or YAML" thrown in usebruno/bruno.

Source

Thrown at packages/bruno-cli/src/commands/import.js:141

        return content;
      }
    } else {
      // Handle file input
      if (!await exists(source)) {
        throw new Error(`File does not exist: ${source}`);
      }
      content = fs.readFileSync(source, 'utf8');
    }

    // If content is a string, try to parse as JSON or YAML
    if (typeof content === 'string') {
      try {
        return JSON.parse(content);
      } catch (jsonError) {
        try {
          return jsyaml.load(content);
        } catch (yamlError) {
          throw new Error('Failed to parse content as JSON or YAML');
        }
      }
    }

    return content;
  } catch (error) {
    // Let the specific error handling from above propagate
    throw error;
  }
};

const readWSDLFile = async (source, options = {}) => {
  try {
    let content;

    if (isUrl(source)) {
      // Handle URL input
      console.log(chalk.yellow(`Fetching WSDL from URL: ${source}`));

View on GitHub (pinned to 9bdd81c7bd)

Solutions

  1. Validate the file content with a JSON/YAML linter.
  2. Ensure the downloaded or provided content is the actual collection document, not an HTML error page.

When it happens

Trigger: Thrown at packages/bruno-cli/src/commands/import.js:141 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13). Data as JSON: /api/errors/eca54ebf2fe0f5cd. Report an issue: GitHub.