I have a pet ghast (named with a Name Tag) in Minecraft Bedrock Edition, but it keeps disappearing even though it’s in a secure and safe enclosure. This makes the "Happy Ghast" feature unusable because the mob despawns without any reason.
Environment
Minecraft Bedrock Edition v1.21.2
Platform:Android
World Type: Survival, Normal Difficulty
No resource packs, no add-ons, no experimental features enabled (Realm)
If there are walls close to the ghast it will suffocate. Try keeping it in an open space with a lead to a fence post.