How can I change the behavior of actor to execute the received command

I would like to stash the received message and migrate the data after the success of the migration I change the behavior to execute the stashed command.

trait Actor { this: Stash with Actor =>
   def executeCommands: Receive = {
     case "OK" => sender ! "ok"
     case _ => sender ! "false"

  def migrateData(): Future[Unit Or Error] = Future.successful(Good(()))

   override def receive: Receive ={
      case _ =>
            migrateData().map {
             case Good(_) =>
            case Bad(err) =>
              sender ! err
  }   } }

I recive an exception `` AskTimeoutException is that the recipient actor didn’t send a reply.
at akka.pattern.PromiseActorRef$.$anonfun$defaultOnTimeout$1(AskSupport.scala:646)
at akka.pattern.PromiseActorRef$.$anonfun$apply$1(AskSupport.scala:667)

You try to become and unstashAll from a future callback. That is not allowed. Instead you should pipe the result of the future to self and when that message is received you can become and unstashAll.