What does Acts 12:9 mean?
A moment ago, Peter was fast asleep, sitting in chains in a prison in Jerusalem, flanked by Roman soldiers. Herod Agrippa I had waited until the Feast of Unleavened Bread was complete, but now he is ready to do the Sanhedrin a favor that will ensure their goodwill: execute Peter as he has James, the brother of John (Acts 12:1–2). An angel appears, nudges Peter until he awakens, and tells him to dress. By this time, Peter has no fear of death, but he has had experience with visions, so though he obeys, he's not exactly sure what's going on (Acts 12:3–8).Not long before, Peter had a vision of a sheet that lowered from heaven displaying an assortment of animals. A voice told Peter to kill and eat even though some of them were banned by the Mosaic law. Still, the voice told him "What God has made clean, do not call common" (Acts 10:15). After a few back-and-forth interactions and a trip to Caesarea Maritima, Peter came to realize the animals represented people, and it was time for Jesus' story to come to the Gentiles (Acts 10).
So, Peter thinks, God must have another significant message for him. It's not clear why Peter doesn't assume the obvious—that a real angel is really helping him escape—as it's happened before (Acts 5:19). But Peter so trusts God's plan for him that he's able to sleep the night of his execution and accept a vision of escape rather than the real thing.