In case unstashAll is called with a Set containing a null value we get an ugly message in the log: Unstash failed: null (Could not instantiate {name=null} for UnstashStep(name: String): This can be avoided by unstashing only in case we have an ID.