Error: SDL_RWFromFile(): No file or no mode specified
===

I'm making a program with PyGame and I keep getting the error SDL_RWFromFile(): No file or no mode specified. Here's the full error code:

    Traceback (most recent call last):
      File "/Users/.../main.py", line 23, in <module>
        main()
      File "/Users/.../main.py", line 18, in main
        game.update()
      File "/Users/.../game.py", line 35, in update
        self.scene.update()
      File "/Users/.../engine.py", line 168, in update
        self._switch_to_microgame()
      File "/Users/.../engine.py", line 146, in _switch_to_microgame
        self.scene = self.microgames[self.next_index].make_game(self.game)
      File "/Users/.../game.py", line 26, in make_game
        return Intersect(game)
      File "/Users/.../game.py", line 193, in __init__
        self.ball = Ball(game, 250, 250, 20, 20)
      File "/Users/.../game.py", line 158, in __init__
        self.image, self.rect = load_image(image , x, y)
      File "/Users/.../game.py", line 68, in load_image
        image = load(name)
    error: SDL_RWFromFile(): No file or no mode specified

What's weird is that the error happens at different places each time. Sometimes it causes the code to crash immediately while sometimes it won't happen till I close the program. Any help would be appreciated. Thanks!