Answers.Body: <p>I'd try <a href="https://craftcms.com/docs/4.x/console-commands.html#project-config-rebuild" rel="nofollow noreferrer">rebuilding</a> the YAML files:</p>
  <ol>
  <li><p>Download and import a database dump from production to your local environment. This ensures that the rebuilt YAML files will mirror the config currently applied in your production environment. Alternatively, you can skip this step if you know that your local environment has the most up-to-date project config.</p>
  </li>
  <li><p>In your local environment, either run <code>php craft project-config/rebuild</code> or simply delete the entire <code>config/project</code> folder and visit the control panel.</p>
  </li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-26T06:35:11.810Z
Answers.Text: This worked to solve the YAML misconfiguration.
Answers.UserDisplayName: Erol
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-25T09:39:44.363Z
Answers.LastActivityDate: 2023-07-25T09:39:44.363Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <p>I'm getting a Craft-styled internal server error, and when I inspect the logs, it says</p>
  <pre><code>[error][Symfony\Component\Yaml\Exception\ParseException] Symfony\Component\Yaml\Exception\ParseException: You cannot define a sequence item when in a mapping at line 42 (near &quot;-&quot;). in /app/vendor/symfony/yaml/Parser.php:163
  </code></pre>
  <p>It appears a YAML file might be mis-formatted but I didn't see any errors in the project.yaml. I've tried deleting the vendor folder and rebuilding the plugins, but I'm not sure what else to try.</p>
  <p>Stack Trace Below:</p>
  <pre><code>2023-07-25 02:57:45 [-][14731][f615ac3410eafa9bd53fca284d19055a][error][Symfony\Component\Yaml\Exception\ParseException] Symfony\Component\Yaml\Exception\ParseException: You cannot define a sequence item when in a mapping at line 42 (near &quot;-&quot;). in /app/vendor/symfony/yaml/Parser.php:163
  Stack trace:
  #0 /app/vendor/symfony/yaml/Parser.php(537): Symfony\Component\Yaml\Parser-&gt;doParse(Array, 0)
  #1 /app/vendor/symfony/yaml/Parser.php(188): Symfony\Component\Yaml\Parser-&gt;parseBlock(4, 'elements:\n  -\n ...', 0)
  #2 /app/vendor/symfony/yaml/Parser.php(537): Symfony\Component\Yaml\Parser-&gt;doParse('-\n  elements:\n ...', 0)
  #3 /app/vendor/symfony/yaml/Parser.php(332): Symfony\Component\Yaml\Parser-&gt;parseBlock(3, '-\n  elements:\n ...', 0)
  #4 /app/vendor/symfony/yaml/Parser.php(537): Symfony\Component\Yaml\Parser-&gt;doParse('tabs:\n  -\n    e...', 0)
  #5 /app/vendor/symfony/yaml/Parser.php(332): Symfony\Component\Yaml\Parser-&gt;parseBlock(2, 'tabs:\n  -\n    e...', 0)
  #6 /app/vendor/symfony/yaml/Parser.php(537): Symfony\Component\Yaml\Parser-&gt;doParse('b1f78753-1e91-4...', 0)
  #7 /app/vendor/symfony/yaml/Parser.php(332): Symfony\Component\Yaml\Parser-&gt;parseBlock(1, 'b1f78753-1e91-4...', 0)
  #8 /app/vendor/symfony/yaml/Parser.php(97): Symfony\Component\Yaml\Parser-&gt;doParse('fieldLayouts:\n ...', 0)
  #9 /app/vendor/symfony/yaml/Yaml.php(80): Symfony\Component\Yaml\Parser-&gt;parse('fieldLayouts:\n ...', 0)
  #10 /app/vendor/craftcms/cms/src/services/ProjectConfig.php(1397): Symfony\Component\Yaml\Yaml::parse('fieldLayouts:\n ...')
  #11 /app/vendor/craftcms/cms/src/services/ProjectConfig.php(1449): craft\services\ProjectConfig-&gt;_getConfigurationFromYaml()
  #12 /app/vendor/craftcms/cms/src/services/ProjectConfig.php(690): craft\services\ProjectConfig-&gt;_getPendingChanges(NULL, true)
  #13 /app/vendor/craftcms/cms/src/helpers/Cp.php(258): craft\services\ProjectConfig-&gt;areChangesPending()
  #14 /app/vendor/craftcms/cms/src/web/twig/variables/Cp.php(476): craft\helpers\Cp::alerts('dashboard')
  #15 /app/vendor/twig/twig/src/Extension/CoreExtension.php(1570): craft\web\twig\variables\Cp-&gt;getAlerts()
  #16 /app/vendor/craftcms/cms/src/helpers/Template.php(106): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\web\twig\variables\Cp), 'getAlerts', Array, 'method', false, false)
  #17 /app/storage/runtime/compiled_templates/d4/d4db0015af8699f3d4a34e984d19ea0ee183ebeae1a7b5153174dfdb06d2569d.php(41): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\web\twig\variables\Cp), 'getAlerts', Array, 'method')
  #18 /app/vendor/twig/twig/src/Template.php(405): __TwigTemplate_508e071878d8b066c1d06f77fb382c967b4fa8d037b92876c3109c9b2bdb8f65-&gt;doDisplay(Array, Array)
  #19 /app/vendor/twig/twig/src/Template.php(378): Twig\Template-&gt;displayWithErrorHandling(Array, Array)
  #20 /app/storage/runtime/compiled_templates/3b/3bffee0a6e0d4fdfe394b99fbb9807f65a156cf50c87029f61f87bc29e3691e2.php(198): Twig\Template-&gt;display(Array)
  #21 /app/vendor/twig/twig/src/Template.php(182): __TwigTemplate_3ac886c1917c0971c2448b448b1075a0b8aa556fc7ecef6b0f62c86e14f3b7ad-&gt;block_body(Array, Array)
  #22 /app/storage/runtime/compiled_templates/ca/cacbe314ee18ee889fd4ba87cb4afe9c82ef6fa5f0ace0c547dc3f072421bc9c.php(91): Twig\Template-&gt;displayBlock('body', Array, Array)
  #23 /app/vendor/twig/twig/src/Template.php(405): __TwigTemplate_f5a8b71dceb67ec87b9af1ae3700d1afb377924a32e852a82f0034e22b60121f-&gt;doDisplay(Array, Array)
  #24 /app/vendor/twig/twig/src/Template.php(378): Twig\Template-&gt;displayWithErrorHandling(Array, Array)
  #25 /app/storage/runtime/compiled_templates/9f/9fdc34328a2b02b874cce5668df2e643e64ca2d07cbaef18685e81d13421f385.php(56): Twig\Template-&gt;display(Array, Array)
  #26 /app/vendor/twig/twig/src/Template.php(405): __TwigTemplate_c0b19ef3da2248dbecac94f55b713d1061b8f9d95914e7eca97f633512c9821e-&gt;doDisplay(Array, Array)
  #27 /app/vendor/twig/twig/src/Template.php(378): Twig\Template-&gt;displayWithErrorHandling(Array, Array)
  #28 /app/storage/runtime/compiled_templates/3b/3bffee0a6e0d4fdfe394b99fbb9807f65a156cf50c87029f61f87bc29e3691e2.php(174): Twig\Template-&gt;display(Array, Array)
  #29 /app/vendor/twig/twig/src/Template.php(405): __TwigTemplate_3ac886c1917c0971c2448b448b1075a0b8aa556fc7ecef6b0f62c86e14f3b7ad-&gt;doDisplay(Array, Array)
  #30 /app/vendor/twig/twig/src/Template.php(378): Twig\Template-&gt;displayWithErrorHandling(Array, Array)
  #31 /app/storage/runtime/compiled_templates/17/1795d916ef278dd392b1564d14008d739de6a228568d76779952e0d4ab22bbc7.php(47): Twig\Template-&gt;display(Array, Array)
  #32 /app/vendor/twig/twig/src/Template.php(405): __TwigTemplate_eeb6f983de08789bd871b6b2250a3a81b0669b60a783de96bf454770807a4091-&gt;doDisplay(Array, Array)
  #33 /app/vendor/twig/twig/src/Template.php(378): Twig\Template-&gt;displayWithErrorHandling(Array, Array)
  #34 /app/vendor/twig/twig/src/Template.php(390): Twig\Template-&gt;display(Array)
  #35 /app/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template-&gt;render(Array, Array)
  #36 /app/vendor/twig/twig/src/Environment.php(318): Twig\TemplateWrapper-&gt;render(Array)
  #37 /app/vendor/craftcms/cms/src/web/View.php(408): Twig\Environment-&gt;render('dashboard/_inde...', Array)
  #38 /app/vendor/craftcms/cms/src/web/View.php(461): craft\web\View-&gt;renderTemplate('dashboard/_inde...', Array)
  #39 /app/vendor/craftcms/cms/src/web/Controller.php(216): craft\web\View-&gt;renderPageTemplate('dashboard/_inde...', Array, 'cp')
  #40 /app/vendor/craftcms/cms/src/controllers/DashboardController.php(142): craft\web\Controller-&gt;renderTemplate('dashboard/_inde...', Array)
  #41 [internal function]: craft\controllers\DashboardController-&gt;actionIndex()
  #42 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
  #43 /app/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction-&gt;runWithParams(Array)
  #44 /app/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller-&gt;runAction('index', Array)
  #45 /app/vendor/craftcms/cms/src/web/Application.php(295): yii\base\Module-&gt;runAction('dashboard/index', Array)
  #46 /app/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application-&gt;runAction('dashboard/index', Array)
  #47 /app/vendor/craftcms/cms/src/web/Application.php(280): yii\web\Application-&gt;handleRequest(Object(craft\web\Request))
  #48 /app/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application-&gt;handleRequest(Object(craft\web\Request))
  #49 /app/web/index.php(23): yii\base\Application-&gt;run()
  #50 {main}
  </code></pre>
  
Tags: <project.yaml>
Title: Internal Server Error YAML Parse Exception
ThreadText: # Internal Server Error YAML Parse Exception
  
  (Asked by: username_0 on 2023-07-25)
  
  I'm getting a Craft-styled internal server error, and when I inspect the logs, it says
  
  ```
  [error][Symfony\Component\Yaml\Exception\ParseException] Symfony\Component\Yaml\Exception\ParseException: You cannot define a sequence item when in a mapping at line 42 (near "-"). in /app/vendor/symfony/yaml/Parser.php:163
  
  ```
  
  It appears a YAML file might be mis-formatted but I didn't see any errors in the project.yaml. I've tried deleting the vendor folder and rebuilding the plugins, but I'm not sure what else to try.
  
  Stack Trace Below:
  
  ```
  2023-07-25 02:57:45 [-][14731][f615ac3410eafa9bd53fca284d19055a][error][Symfony\Component\Yaml\Exception\ParseException] Symfony\Component\Yaml\Exception\ParseException: You cannot define a sequence item when in a mapping at line 42 (near "-"). in /app/vendor/symfony/yaml/Parser.php:163
  Stack trace:
  #0 /app/vendor/symfony/yaml/Parser.php(537): Symfony\Component\Yaml\Parser->doParse(Array, 0)
  #1 /app/vendor/symfony/yaml/Parser.php(188): Symfony\Component\Yaml\Parser->parseBlock(4, 'elements:\n  -\n ...', 0)
  #2 /app/vendor/symfony/yaml/Parser.php(537): Symfony\Component\Yaml\Parser->doParse('-\n  elements:\n ...', 0)
  #3 /app/vendor/symfony/yaml/Parser.php(332): Symfony\Component\Yaml\Parser->parseBlock(3, '-\n  elements:\n ...', 0)
  #4 /app/vendor/symfony/yaml/Parser.php(537): Symfony\Component\Yaml\Parser->doParse('tabs:\n  -\n    e...', 0)
  #5 /app/vendor/symfony/yaml/Parser.php(332): Symfony\Component\Yaml\Parser->parseBlock(2, 'tabs:\n  -\n    e...', 0)
  #6 /app/vendor/symfony/yaml/Parser.php(537): Symfony\Component\Yaml\Parser->doParse('b1f78753-1e91-4...', 0)
  #7 /app/vendor/symfony/yaml/Parser.php(332): Symfony\Component\Yaml\Parser->parseBlock(1, 'b1f78753-1e91-4...', 0)
  #8 /app/vendor/symfony/yaml/Parser.php(97): Symfony\Component\Yaml\Parser->doParse('fieldLayouts:\n ...', 0)
  #9 /app/vendor/symfony/yaml/Yaml.php(80): Symfony\Component\Yaml\Parser->parse('fieldLayouts:\n ...', 0)
  #10 /app/vendor/craftcms/cms/src/services/ProjectConfig.php(1397): Symfony\Component\Yaml\Yaml::parse('fieldLayouts:\n ...')
  #11 /app/vendor/craftcms/cms/src/services/ProjectConfig.php(1449): craft\services\ProjectConfig->_getConfigurationFromYaml()
  #12 /app/vendor/craftcms/cms/src/services/ProjectConfig.php(690): craft\services\ProjectConfig->_getPendingChanges(NULL, true)
  #13 /app/vendor/craftcms/cms/src/helpers/Cp.php(258): craft\services\ProjectConfig->areChangesPending()
  #14 /app/vendor/craftcms/cms/src/web/twig/variables/Cp.php(476): craft\helpers\Cp::alerts('dashboard')
  #15 /app/vendor/twig/twig/src/Extension/CoreExtension.php(1570): craft\web\twig\variables\Cp->getAlerts()
  #16 /app/vendor/craftcms/cms/src/helpers/Template.php(106): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\web\twig\variables\Cp), 'getAlerts', Array, 'method', false, false)
  #17 /app/storage/runtime/compiled_templates/d4/d4db0015af8699f3d4a34e984d19ea0ee183ebeae1a7b5153174dfdb06d2569d.php(41): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\web\twig\variables\Cp), 'getAlerts', Array, 'method')
  #18 /app/vendor/twig/twig/src/Template.php(405): __TwigTemplate_508e071878d8b066c1d06f77fb382c967b4fa8d037b92876c3109c9b2bdb8f65->doDisplay(Array, Array)
  #19 /app/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
  #20 /app/storage/runtime/compiled_templates/3b/3bffee0a6e0d4fdfe394b99fbb9807f65a156cf50c87029f61f87bc29e3691e2.php(198): Twig\Template->display(Array)
  #21 /app/vendor/twig/twig/src/Template.php(182): __TwigTemplate_3ac886c1917c0971c2448b448b1075a0b8aa556fc7ecef6b0f62c86e14f3b7ad->block_body(Array, Array)
  #22 /app/storage/runtime/compiled_templates/ca/cacbe314ee18ee889fd4ba87cb4afe9c82ef6fa5f0ace0c547dc3f072421bc9c.php(91): Twig\Template->displayBlock('body', Array, Array)
  #23 /app/vendor/twig/twig/src/Template.php(405): __TwigTemplate_f5a8b71dceb67ec87b9af1ae3700d1afb377924a32e852a82f0034e22b60121f->doDisplay(Array, Array)
  #24 /app/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
  #25 /app/storage/runtime/compiled_templates/9f/9fdc34328a2b02b874cce5668df2e643e64ca2d07cbaef18685e81d13421f385.php(56): Twig\Template->display(Array, Array)
  #26 /app/vendor/twig/twig/src/Template.php(405): __TwigTemplate_c0b19ef3da2248dbecac94f55b713d1061b8f9d95914e7eca97f633512c9821e->doDisplay(Array, Array)
  #27 /app/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
  #28 /app/storage/runtime/compiled_templates/3b/3bffee0a6e0d4fdfe394b99fbb9807f65a156cf50c87029f61f87bc29e3691e2.php(174): Twig\Template->display(Array, Array)
  #29 /app/vendor/twig/twig/src/Template.php(405): __TwigTemplate_3ac886c1917c0971c2448b448b1075a0b8aa556fc7ecef6b0f62c86e14f3b7ad->doDisplay(Array, Array)
  #30 /app/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
  #31 /app/storage/runtime/compiled_templates/17/1795d916ef278dd392b1564d14008d739de6a228568d76779952e0d4ab22bbc7.php(47): Twig\Template->display(Array, Array)
  #32 /app/vendor/twig/twig/src/Template.php(405): __TwigTemplate_eeb6f983de08789bd871b6b2250a3a81b0669b60a783de96bf454770807a4091->doDisplay(Array, Array)
  #33 /app/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
  #34 /app/vendor/twig/twig/src/Template.php(390): Twig\Template->display(Array)
  #35 /app/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render(Array, Array)
  #36 /app/vendor/twig/twig/src/Environment.php(318): Twig\TemplateWrapper->render(Array)
  #37 /app/vendor/craftcms/cms/src/web/View.php(408): Twig\Environment->render('dashboard/_inde...', Array)
  #38 /app/vendor/craftcms/cms/src/web/View.php(461): craft\web\View->renderTemplate('dashboard/_inde...', Array)
  #39 /app/vendor/craftcms/cms/src/web/Controller.php(216): craft\web\View->renderPageTemplate('dashboard/_inde...', Array, 'cp')
  #40 /app/vendor/craftcms/cms/src/controllers/DashboardController.php(142): craft\web\Controller->renderTemplate('dashboard/_inde...', Array)
  #41 [internal function]: craft\controllers\DashboardController->actionIndex()
  #42 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
  #43 /app/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
  #44 /app/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('index', Array)
  #45 /app/vendor/craftcms/cms/src/web/Application.php(295): yii\base\Module->runAction('dashboard/index', Array)
  #46 /app/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('dashboard/index', Array)
  #47 /app/vendor/craftcms/cms/src/web/Application.php(280): yii\web\Application->handleRequest(Object(craft\web\Request))
  #48 /app/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
  #49 /app/web/index.php(23): yii\base\Application->run()
  #50 {main}
  
  ```
  
  **Tags:** project.yaml
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-07-25. Score: 2 | Accepted answer
  
  I'd try [rebuilding](https://craftcms.com/docs/4.x/console-commands.html#project-config-rebuild) the YAML files:
  
  1. Download and import a database dump from production to your local environment. This ensures that the rebuilt YAML files will mirror the config currently applied in your production environment. Alternatively, you can skip this step if you know that your local environment has the most up-to-date project config.
  2. In your local environment, either run `php craft project-config/rebuild` or simply delete the entire `config/project` folder and visit the control panel.
  
  > **Comments:**
  > **username_0**: This worked to solve the YAML misconfiguration.  
  
  ---
  
  