I'm currently an American sophomore undergrad and I'm looking into research opportunities at the moment. My problem is that the area of mathematics that interests me the most is mathematical logic and set theory, and even more specifically inconsistent mathematics, but there appear to be no opportunities for undergraduate research in this field. I'm unsure what to do or what would be the most helpful choices for me at this point. I know my college recommends cold-emailing professors if I have trouble finding something, but I'm also worried that I'm narrowing my search down too much. So should broaden my search first, just go ahead and start writing emails, or do both at the same time?
I suggest you greatly broaden your search. There are common features to all research. Perhaps even look at research projects and programs in adjacent areas, like combinatorial research in computer science.
Since you could easily wait until the following summer to get involved in a research project, you can write programs and professors (in the area, or where you might want to visit) and ask about what you might do to prepare for the projects that exists. If you do not know computer programming, perhaps that is a gap needing a fill.
It would be good to be exposed to many areas of mathematics before you decide on what you focus upon in graduate school. I was convinced I wanted to to algebra when I was an undergraduate, but then topology started to be appealing. In graduate school I switched to analysis. Now I mostly do applied math research related to physics.
I'm currently an American sophomore
Not to sound dismissive, but I wouldn't be too focused on one area of math at this stage in your career (note: not a mathematician). Many (most?) sophomores haven't declared a major yet, much less settled on an area for graduate studies. That is to say, don't dismiss opportunities in other areas - you might find that you enjoy research more in those areas, even if you didn't like the classes.
So should broaden my search first, just go ahead and start writing emails, or do both at the same time?
I think most people would agree cold emails are the least successful way of obtaining anything, especially during COVID when professors are even more overworked than they were a year ago. My point is, is if they haven't posted looking for an undergrad, they aren't very likely to have the bandwidth to add one.
So I would strongly recommend finding an open position that at least somewhat interests you, doing good at it, and using that professor to help you find a position closer to your interests (perhaps supervising a bachelor's thesis?). When that set theory position opens; you're going to be more competitive with a year of work behind you than without.