Level up your skills at DrupalCon Chicago 2026 with focused Summits and immersive, hands-on Trainings led by community experts.
Problem/Motivation
When installing Drupal profile with features that include webforms the following error occurs
In Inline.php line 199:
[Symfony\Component\Yaml\Exception\DumpException]
Object support when dumping a YAML file has been disabled.
Exception trace:
at /www/app/vendor/symfony/yaml/Inline.php:199
Symfony\Component\Yaml\Inline::dump() at /www/app/vendor/symfony/yaml/Dumper.php:97
Symfony\Component\Yaml\Dumper->dump() at /www/app/vendor/symfony/yaml/Dumper.php:153
Symfony\Component\Yaml\Dumper->dump() at /www/app/vendor/symfony/yaml/Dumper.php:153
Symfony\Component\Yaml\Dumper->dump() at /www/app/vendor/symfony/yaml/Dumper.php:153
Symfony\Component\Yaml\Dumper->dump() at /www/app/web/modules/contrib/webform/src/Utility/WebformYaml.php:31
Drupal\webform\Utility\WebformYaml::encode() at /www/app/web/modules/contrib/webform/includes/webform.editor.inc:138
_webform_get_array_file_uuids() at /www/app/web/modules/contrib/webform/includes/webform.editor.inc:119
_webform_get_config_entity_file_uuids() at /www/app/web/modules/contrib/webform/includes/webform.editor.inc:33
webform_webform_insert() at n/a:n/a
call_user_func_array() at /www/app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:403
Drupal\Core\Extension\ModuleHandler->invokeAll() at /www/app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:347
Drupal\Core\Config\Entity\ConfigEntityStorage->invokeHook() at /www/app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:535
Drupal\Core\Entity\EntityStorageBase->doPostSave() at /www/app/web/modules/contrib/webform/src/WebformEntityStorage.php:85
Drupal\webform\WebformEntityStorage->doPostSave() at /www/app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:460
Drupal\Core\Entity\EntityStorageBase->save() at /www/app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:263
Drupal\Core\Config\Entity\ConfigEntityStorage->save() at /www/app/web/modules/contrib/webform/src/WebformEntityStorage.php:92
Drupal\webform\WebformEntityStorage->save() at /www/app/web/core/lib/Drupal/Core/Entity/EntityBase.php:395
Drupal\Core\Entity\EntityBase->save() at /www/app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php:616
Drupal\Core\Config\Entity\ConfigEntityBase->save() at /www/app/web/core/lib/Drupal/Core/Config/ConfigInstaller.php:371
Drupal\Core\Config\ConfigInstaller->createConfiguration() at /www/app/web/modules/contrib/features/src/FeaturesConfigInstaller.php:99
Drupal\features\FeaturesConfigInstaller->createConfiguration() at /www/app/web/core/lib/Drupal/Core/Config/ConfigInstaller.php:137
Drupal\Core\Config\ConfigInstaller->installDefaultConfig() at /www/app/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php:287
Drupal\Core\Extension\ModuleInstaller->install() at /www/app/web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php:83
Drupal\Core\ProxyClass\Extension\ModuleInstaller->install() at /www/app/web/profiles/profile/profile.install:70
profile_install() at n/a:n/a
call_user_func_array() at /www/app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:392
Drupal\Core\Extension\ModuleHandler->invoke() at /www/app/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php:325
Drupal\Core\Extension\ModuleInstaller->install() at /www/app/web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php:83
Drupal\Core\ProxyClass\Extension\ModuleInstaller->install() at /www/app/web/core/includes/install.core.inc:1649
install_install_profile() at /www/app/web/core/includes/install.core.inc:695
install_run_task() at /www/app/web/core/includes/install.core.inc:570
install_run_tasks() at /www/app/web/core/includes/install.core.inc:118
install_drupal() at /www/app/vendor/drush/drush/includes/drush.inc:229
drush_call_user_func_array() at /www/app/vendor/drush/drush/includes/drush.inc:214
drush_op() at /www/app/vendor/drush/drush/src/Commands/core/SiteInstallCommands.php:145
Drush\Commands\core\SiteInstallCommands->install() at n/a:n/a
call_user_func_array() at /www/app/vendor/consolidation/annotated-command/src/CommandProcessor.php:257
Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() at /www/app/vendor/consolidation/annotated-command/src/CommandProcessor.php:212
Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() at /www/app/vendor/consolidation/annotated-command/src/CommandProcessor.php:178
Consolidation\AnnotatedCommand\CommandProcessor->process() at /www/app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:302
Consolidation\AnnotatedCommand\AnnotatedCommand->execute() at /www/app/vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /www/app/vendor/symfony/console/Application.php:1005
Symfony\Component\Console\Application->doRunCommand() at /www/app/vendor/symfony/console/Application.php:255
Symfony\Component\Console\Application->doRun() at /www/app/vendor/symfony/console/Application.php:148
Symfony\Component\Console\Application->run() at /www/app/vendor/drush/drush/src/Runtime/Runtime.php:118
Drush\Runtime\Runtime->doRun() at /www/app/vendor/drush/drush/src/Runtime/Runtime.php:49
Drush\Runtime\Runtime->run() at /www/app/vendor/drush/drush/drush.php:72
require() at /www/app/drush9:47
which is similar to #3091252: Computed Twig leads to YAML Object Error.
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | webform-yaml-patch-20.patch | 498 bytes | amjad1233 |
| #2 | webform-6-yaml-3194495-2.patch | 910 bytes | vladimiraus |
Comments
Comment #2
vladimirausComment #5
jrockowitz commentedWe should determine where and how Markup is being added to a Webform's config via a profile.
Comment #6
vladimirausIn my case it is not in the profile, it is in another module as yml config file.
Comment #7
jrockowitz commentedCan you please upload an example of the configuration or module which is triggering the error?
I would like to be able to reproduce the issue before applying the patch.
Comment #9
vladimirausThank @jrockowitz. I’m still debugging it trying to confirm it is caused by webform and not a custom plugin
Comment #10
jrockowitz commentedAre you using the default language which is English? If not, it is possible that Drupal core is translating the webform's strings during the installation.
Comment #11
vladimirausYep, using single language website in english.
Comment #12
jrockowitz commentedSomething is definitely converting strings into Markup or adding Markup to the webform's settings.
My hesitation about applying the patch is it will slow down the saving of webform.
Comment #13
jrockowitz commentedPlease reopen this ticket when you can provide example of the configuration or module which is triggering the error.
Comment #14
jcandan commentedThe "Object support when dumping a YAML file has been disabled." error occurs with my project as well.
After upgrading to Webform 6 I am able to get the site install to complete with only 1 out of the 11 webform configs I have. Patch #2 helped me overcome the error for all 11.
I attempted to recreate the issue with a clean Drupal instance and a bare-bones custom install profile with one of my non-working webform configuration files; however I was unable to replicate the error there.
Note (in case it helps): In this attempt, I commented out a couple of custom third party settings.
Comment #15
jfauske commentedI came across this issue when updating a custom module to work with Drupal 9.
In my case the markup came from using @translation(...) on fields in in the WebformHandler annotation.
This makes i.e the handler label an instance of Drupal\Core\StringTranslation\TranslatableMarkup instead of a string in the $data passed to _webform_get_array_file_uuids().
i.e this will trigger the issue:
This will not:
Comment #16
flocondetoileI came across this issue with a custom module which have 3 custom Plugin WebformHandler. Applying comments in #15 fix the issue.
Thanks @jfauske I believe you saved my night. The automatic process for building a project was broken.
I think we have the root cause, no ? So, status back to Active.
Comment #17
priya sundharam commented.
Comment #18
jrockowitz commentedDoes the patch from #2 fix this issue?
Comment #19
jfauske commentedYes, the patch in #2 fix the issue.
Though I'm not sure if it's the optimal place to "sanitize" the content of the $data array.
That's for someone with more insight to evaluate.
Comment #20
amjad1233The issue came up when I was doing a functional test where I had to create a webform programatically.
The error started when I added `$this->t()` function to `#options` value using `Drupal\Core\StringTranslation\StringTranslationTrait;`
I did render element bit differently in the Webform::setElement method just before encoding it we render all the strings.
If accepted solution I am happy to write some tests around it.
Comment #21
jrockowitz commentedIn your code, you should be casting the TranslatedMarkup to strings via
'option_1' => (string) $this->t('Option 1'),.Also, it is worth noting that strings in tests do not need to be translated unless you are testing translations.
@see #3133726: [meta] Remove usage of t() in tests not testing translation
Comment #22
amjad1233Thanks @jrockowitz.
That works perfect. The only reason I added t() function is because the phpcs was complaining about form options not being translated.
Comment #23
larowlanphpcs is not accurate in this regard, it is misinterpreting it as Form API code, but its webform code.
Run phpcs -as and take note of the rule that is wrong, and wrap your code with something like the below
e.g. if the rule is DrupalPractice.General.DescriptionT.DescriptionT
You should wrap that hunk with