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
- Ensure at least one file is selected before invoking importBrunoEnvironment.
- Guard upstream: check files?.length > 0 before calling readMultipleFiles.
- 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
- Gate the import button on a non-empty file selection.
- Check files?.length > 0 before calling readMultipleFiles or importBrunoEnvironment.
- Test the import flow with zero files to confirm graceful handling.
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
- Invalid environment: expected an object
- Invalid environment: missing or invalid variables array
- Invalid variable at index ${index}: expected an object
- Invalid variable at index ${index}: missing or invalid name
- No files selected
AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13).
Data as JSON: /api/errors/5e387dd01427ac87.
Report an issue: GitHub.