Dogs aren’t born with the ability to generalize behaviors in a variety of different environments or under novel distractions- it takes time and experience. In the following video, Autumn's excitement to get on the other side of the fence hijacks her ability to perform basic cues. In contrast, she can perform all of these cues easily in the less exciting environment of her living room. (Trainer insight: it is likely that she has had a high rate of reinforcement for performing these cues in her living room - which increases the odds of correct performance).
If you've hosted for any length of time, we bet you've encountered this situation on at least one occasion! Just like we don't perform at our best when we are experiencing stress, neither do dogs. It's our job as handlers to make performing tasks easier for the dog when we recognize that they are struggling. The resources below provide information on why the dog may be having difficulty and how to break things down to make success more likely while also providing more support for the dog.