usebruno/bruno · error · Error
Failed to parse the file – ensure it is valid JSON or YAML
Error message
Failed to parse the file – ensure it is valid JSON or YAML
What it means
Error "Failed to parse the file – ensure it is valid JSON or YAML" thrown in usebruno/bruno.
Source
Thrown at packages/bruno-app/src/components/Sidebar/ImportCollection/FileTab.js:32
const text = await file.text();
// Handle WSDL files - return as plain text
if (file.name.endsWith('.wsdl') || file.type === 'text/xml' || file.type === 'application/xml') {
return text;
}
try {
if (file.type === 'application/json' || file.name.endsWith('.json')) {
return JSON.parse(text);
}
const parsed = jsyaml.load(text, { schema: jsyaml.JSON_SCHEMA });
if (typeof parsed !== 'object' || parsed === null) {
throw new Error();
}
return parsed;
} catch {
throw new Error('Failed to parse the file – ensure it is valid JSON or YAML');
}
};
const FileTab = ({
setIsLoading,
handleSubmit,
setErrorMessage
}) => {
const [dragActive, setDragActive] = useState(false);
const fileInputRef = useRef(null);
const { theme } = useTheme();
const acceptedFileTypes = [
'.json',
'.yaml',
'.yml',
'.wsdl',
'.zip',View on GitHub (pinned to 9bdd81c7bd)
Solutions
- Open the file in an editor and validate its JSON/YAML syntax.
- Fix syntax errors (trailing commas, bad indentation) and retry the import.
When it happens
Trigger: Thrown at packages/bruno-app/src/components/Sidebar/ImportCollection/FileTab.js:32 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13).
Data as JSON: /api/errors/ab8dcc9848ee0584.
Report an issue: GitHub.