swagger-api / swagger-api/swagger-ui
TypeError: Cannot read properties of undefined (reading 'match')
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Error loading content from the uploaded file. Detail is that the content of the file is read in the frontend, below the source code and screenshot of the error
Q&A (please complete the following information)
- OS: Linux
- Browser: Firefox
- Version: 106.0.5
- Method of installation: npm
- Swagger-UI version: 4.14.2
- Swagger/OpenAPI version: OpenAPI 3.0
Screenshots

Content & configuration
Source code example:
import { useState } from "react";
import SwaggerUI from "swagger-ui-react";
import "swagger-ui-react/swagger-ui.css";
function App() {
const [file, setFile] = useState();
const handleChange = (e) => {
const fileReader = new FileReader();
fileReader.readAsText(e.target.files[0], "UTF-8");
fileReader.onload = (e) => {
setFile(e.target.result);
};
};
return (
<div>
<h2>Error Swagger Console</h2>
<input type="file" onChange={handleChange} />
{file && <SwaggerUI spec={file} />}
</div>
);
}
export default App;
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided React reproduction in App, where the uploaded file is passed to the SwaggerUI spec prop, and trace the file-loading and spec-parsing entry point that produces the match error. Done means the supplied OpenAPI 3.0 file loads in the shown Firefox setup without the TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100