Possibilities:
1. you left a hostile area via teleporters and one is in your house. The game thinks, you're still nearby. (I had that in one game, couldn't use my bed again)

2. There is a short time delay until you can sleep the next time