Here's my setup: When a user of a specifc role gets created some nodes with enabled revisions get created automatically. When behat tries to delete the user I get the following exception:
╳ exception 'Drupal\Core\Entity\EntityStorageException' with message 'Default revision can not be deleted' in /var/www/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:339
╳ Stack trace:
╳ #0 /var/www/web/core/modules/node/node.module(470): Drupal\Core\Entity\ContentEntityStorageBase->deleteRevision('1004')
╳ #1 /var/www/web/core/modules/node/node.module(720): node_revision_delete('1004')
╳ #2 /var/www/vendor/drupal/drupal-extension/src/Drupal/DrupalExtension/Context/RawDrupalContext.php(232): node_user_predelete(Object(Drupal\user\Entity\User))
╳ #3 [internal function]: Drupal\DrupalExtension\Context\RawDrupalContext->cleanUsers(Object(Behat\Behat\Hook\Scope\AfterScenarioScope))
╳ #4 /var/www/vendor/behat/behat/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php(104): call_user_func_array(Array, Array)
╳ #5 /var/www/vendor/behat/behat/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php(60): Behat\Testwork\Call\Handler\RuntimeCallHandler->executeCall(Object(Behat\Testwork\Hook\Call\HookCall))
╳ #6 /var/www/vendor/behat/behat/src/Behat/Testwork/Call/CallCenter.php(129): Behat\Testwork\Call\Handler\RuntimeCallHandler->handleCall(Object(Behat\Testwork\Hook\Call\HookCall))
╳ #7 /var/www/vendor/behat/behat/src/Behat/Testwork/Call/CallCenter.php(82): Behat\Testwork\Call\CallCenter->handleCall(Object(Behat\Testwork\Hook\Call\HookCall))
╳ #8 /var/www/vendor/behat/behat/src/Behat/Testwork/Hook/HookDispatcher.php(74): Behat\Testwork\Call\CallCenter->makeCall(Object(Behat\Testwork\Hook\Call\HookCall))
╳ #9 /var/www/vendor/behat/behat/src/Behat/Testwork/Hook/HookDispatcher.php(58): Behat\Testwork\Hook\HookDispatcher->dispatchHook(Object(Behat\Behat\Hook\Scope\AfterScenarioScope), Object(Behat\Behat\Hook\Call\AfterScenario))
╳ #10 /var/www/vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableScenarioTester.php(89): Behat\Testwork\Hook\HookDispatcher->dispatchScopeHooks(Object(Behat\Behat\Hook\Scope\AfterScenarioScope))
╳ #11 /var/www/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php(114): Behat\Behat\Hook\Tester\HookableScenarioTester->tearDown(Object(Behat\Behat\Context\Environment\InitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), Object(Behat\Gherkin\Node\ScenarioNode), false, Object(Behat\Testwork\Tester\Result\TestResults))
╳ #12 /var/www/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeFeatureTester.php(84): Behat\Behat\EventDispatcher\Tester\EventDispatchingScenarioTester->tearDown(Object(Behat\Behat\Context\Environment\InitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), Object(Behat\Gherkin\Node\ScenarioNode), false, Object(Behat\Testwork\Tester\Result\TestResults))
╳ #13 /var/www/vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableFeatureTester.php(72): Behat\Behat\Tester\Runtime\RuntimeFeatureTester->test(Object(Behat\Behat\Context\Environment\UninitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), false)
╳ #14 /var/www/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php(71): Behat\Behat\Hook\Tester\HookableFeatureTester->test(Object(Behat\Behat\Context\Environment\UninitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), false)
╳ #15 /var/www/vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeSuiteTester.php(63): Behat\Behat\EventDispatcher\Tester\EventDispatchingFeatureTester->test(Object(Behat\Behat\Context\Environment\UninitializedContextEnvironment), Object(Behat\Gherkin\Node\FeatureNode), false)
╳ #16 /var/www/vendor/behat/behat/src/Behat/Testwork/Hook/Tester/HookableSuiteTester.php(73): Behat\Testwork\Tester\Runtime\RuntimeSuiteTester->test(Object(Behat\Behat\Context\Environment\UninitializedContextEnvironment), Object(Behat\Testwork\Specification\GroupedSpecificationIterator), false)
╳ #17 /var/www/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php(72): Behat\Testwork\Hook\Tester\HookableSuiteTester->test(Object(Behat\Behat\Context\Environment\UninitializedContextEnvironment), Object(Behat\Testwork\Specification\GroupedSpecificationIterator), false)
╳ #18 /var/www/vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeExercise.php(71): Behat\Testwork\EventDispatcher\Tester\EventDispatchingSuiteTester->test(Object(Behat\Behat\Context\Environment\UninitializedContextEnvironment), Object(Behat\Testwork\Specification\GroupedSpecificationIterator), false)
╳ #19 /var/www/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingExercise.php(70): Behat\Testwork\Tester\Runtime\RuntimeExercise->test(Array, false)
╳ #20 /var/www/vendor/behat/behat/src/Behat/Testwork/Ordering/OrderedExercise.php(80): Behat\Testwork\EventDispatcher\Tester\EventDispatchingExercise->test(Array, false)
╳ #21 /var/www/vendor/behat/behat/src/Behat/Testwork/Tester/Cli/ExerciseController.php(146): Behat\Testwork\Ordering\OrderedExercise->test(Array, false)
╳ #22 /var/www/vendor/behat/behat/src/Behat/Testwork/Tester/Cli/ExerciseController.php(108): Behat\Testwork\Tester\Cli\ExerciseController->testSpecifications(Object(Symfony\Component\Console\Input\ArgvInput), Array)
╳ #23 /var/www/vendor/behat/behat/src/Behat/Testwork/Cli/Command.php(63): Behat\Testwork\Tester\Cli\ExerciseController->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
╳ #24 /var/www/vendor/symfony/console/Command/Command.php(259): Behat\Testwork\Cli\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
╳ #25 /var/www/vendor/symfony/console/Application.php(844): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
╳ #26 /var/www/vendor/symfony/console/Application.php(192): Symfony\Component\Console\Application->doRunCommand(Object(Behat\Testwork\Cli\Command), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
╳ #27 /var/www/vendor/behat/behat/src/Behat/Testwork/Cli/Application.php(121): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
╳ #28 /var/www/vendor/symfony/console/Application.php(123): Behat\Testwork\Cli\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
╳ #29 /var/www/vendor/behat/behat/bin/behat(32): Symfony\Component\Console\Application->run()
╳ #30 {main}
│
└─ @AfterScenario # Drupal\DrupalExtension\Context\DrupalContext::cleanUsers()
This is coming from node_user_predelete() which deletes all revisions of a user and chokes about the default revision.
I tried to debug the code but I am out of luck. Running the same code from /devel/php does not throw an exception.