Q. We have a large aquarium at home. If a fish perishes on Shabbat and puts in danger all the other fish. Can one take it out?

A. Cheshed Haefod (50) permits in need to extract the dead fish when it is fit for cat or dog food, relying on the Taz (308: 32) and Bach (ibid) especially when one owns such pets.

Shemiras Shabbos K. (27: 99) is also lenient due to the tzaar baal chaim or pain caused to the other fish. Shebet Halevi (1: 62) is also lenient, however warns that when extracting the dead fish, one should be careful not to transgress the borer prohibitions.

Hurav Shlomo Miller Shlit’a opinion is similar

Rabbi A. Bartfeld as advised by Horav Shlomo Miller and Horav Aharon Miller Shlit’a