What are the mob spawn distances?
Solution 1:
You cannot sleep if there are hostile or mobs that are neutral but are now aggressive within 8 blocks of your bed. Neutral but can be aggressive include wolves, enderman, and zombie pigman. Do keep in mind that there might be mobs hidden underground. Also be sure to light the area up as mobs can still spawn in your base if not properly lit.