usebruno/bruno · error · BrunoError

No files provided

Error message

No files provided

What it means

Entry guard in importBrunoEnvironment. Fires before any parsing when parsedFiles is null, undefined, or an empty array — i.e. the caller passed nothing to import.

Source

Thrown at packages/bruno-app/src/utils/importers/bruno-environment.js:81

const processFiles = (parsedFiles) => {
  const allEnvironments = [];

  for (const parsedFile of parsedFiles) {
    try {
      const environments = processEnvironmentData(parsedFile.content, parsedFile.fileName);
      allEnvironments.push(...environments);
    } catch (err) {
      throw new BrunoError(`Failed to process ${parsedFile.fileName}: ${err.message}`);
    }
  }

  return allEnvironments;
};

const importBrunoEnvironment = (parsedFiles) => {
  try {
    if (!parsedFiles || parsedFiles.length === 0) {
      throw new BrunoError('No files provided');
    }

    const environments = processFiles(parsedFiles);
    return environments;
  } catch (err) {
    console.error(err);
    throw err instanceof BrunoError ? err : new BrunoError('Import Bruno environment failed');
  }
};

export { importBrunoEnvironment, processEnvironmentData };
export default importBrunoEnvironment;

View on GitHub (pinned to 9bdd81c7bd)

Solutions

  1. Ensure at least one file is selected before invoking importBrunoEnvironment.
  2. Guard upstream: check files?.length > 0 before calling readMultipleFiles.
  3. Verify the file input's onChange handler actually populates the files list.

Example fix

// before
const envs = importBrunoEnvironment(parsedFiles);
// after
if (!parsedFiles?.length) {
  toast('Select at least one environment file');
  return;
}
const envs = importBrunoEnvironment(parsedFiles);
Defensive patterns

Strategy: validation

Validate before calling

if (!parsedFiles || parsedFiles.length === 0) {
  throw new Error('Select at least one environment file');
}

Type guard

function hasFiles(files) {
  return Array.isArray(files) && files.length > 0;
}

Try / catch

try {
  importBrunoEnvironment(parsedFiles);
} catch (err) {
  if (err.message === 'No files provided') toast('Choose a file first');
  throw err;
}

Prevention

When it happens

Trigger: Calling importBrunoEnvironment([]), importBrunoEnvironment(null), or importBrunoEnvironment() directly. Upstream, this happens when readMultipleFiles receives no files or the file picker returns an empty selection that still reaches the importer.

Common situations: UI bug where the import flow proceeds despite no file selection, or programmatic use of the importer without first gathering files.

Related errors


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