Not exactly 100% versed in the matter but I did some fair digging before starting my own instance: In Germany as long as you remove illegal content in a timely manner after being made aware of its existence you should be perfectly fine. That does include making sure the content does not pop up again but imo the entire thing is set up in a way where if you have adequate moderation (which you should anyway) there shouldn’t be anything to worry about legally speaking.
Case in point: feddit.de has not blocked the piracy community (yet)