Answers.Body: <p>This sounds like an old bug that was fixed in a more recent version of Craft than the one you are on - <a href="https://github.com/craftcms/cms/issues/6379" rel="nofollow noreferrer">https://github.com/craftcms/cms/issues/6379</a></p>
  <p>Are you able to update Craft and your plugins to the latest version?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-11-24T14:53:23.747Z
Answers.LastActivityDate: 2021-11-24T14:53:23.747Z
Answers.UserDisplayName: Oli
Body: <p>I'm getting intermittent Internal server errors in Craft admin.</p>
  <p>This has happened out of the blue on an active site. Craft pro 3.041</p>
  <p>phperrors.log:</p>
  <pre><code>PHP Notice:  Undefined index: constraint_name in /home/sitename/vendor/yiisoft/yii2/db/mysql/Schema.php on line 387
  PHP Notice:  Undefined index: referenced_table_name in /home/sitename/vendor/yiisoft/yii2/db/mysql/Schema.php on line 387
  PHP Notice:  Undefined index: constraint_name in /home/sitename/vendor/yiisoft/yii2/db/mysql/Schema.php on line 388
  PHP Notice:  Undefined index: column_name in /home/sitename/vendor/yiisoft/yii2/db/mysql/Schema.php on line 388
  PHP Notice:  Undefined index: referenced_column_name in /home/sitename/vendor/yiisoft/yii2/db/mysql/Schema.php on line 388
  </code></pre>
  <p>stack trace:</p>
  <pre><code>yii\base\ErrorException: Undefined index: constraint_name in /home/sitename/vendor/yiisoft/yii2/db/mysql/Schema.php:387
  Stack trace:
  #0 /home/sitename/vendor/craftcms/cms/src/web/ErrorHandler.php(76): yii\base\ErrorHandler-&gt;handleError(8, 'Undefined index...', '/home/libraries...', 387)
  #1 /home/sitename/vendor/yiisoft/yii2/db/mysql/Schema.php(387): craft\web\ErrorHandler-&gt;handleError(8, 'Undefined index...', '/home/libraries...', 387, Array)
  #2 /home/sitename/vendor/craftcms/cms/src/db/mysql/Schema.php(260): yii\db\mysql\Schema-&gt;findConstraints(Object(craft\db\TableSchema))
  #3 /home/sitename/vendor/craftcms/cms/src/db/mysql/Schema.php(244): craft\db\mysql\Schema-&gt;findConstraints(Object(craft\db\TableSchema))
  #4 /home/sitename/vendor/yiisoft/yii2/db/Schema.php(744): craft\db\mysql\Schema-&gt;loadTableSchema('categorygroups')
  #5 /home/sitename/vendor/yiisoft/yii2/db/Schema.php(194): yii\db\Schema-&gt;getTableMetadata('{{%categorygrou...', 'schema', false)
  #6 /home/sitename/vendor/yiisoft/yii2/db/ActiveRecord.php(384): yii\db\Schema-&gt;getTableSchema('{{%categorygrou...')
  #7 /home/sitename/vendor/yiisoft/yii2/db/ActiveRecord.php(458): yii\db\ActiveRecord::getTableSchema()
  #8 /home/sitename/vendor/yiisoft/yii2/db/ActiveQueryTrait.php(123): yii\db\ActiveRecord::populateRecord(Object(craft\records\CategoryGroup), Array)
  #9 /home/sitename/vendor/yiisoft/yii2/db/ActiveQuery.php(207): yii\db\ActiveQuery-&gt;createModels(Array)
  #10 /home/sitename/vendor/yiisoft/yii2/db/Query.php(238): yii\db\ActiveQuery-&gt;populate(Array)
  #11 /home/sitename/vendor/yiisoft/yii2/db/ActiveQuery.php(133): yii\db\Query-&gt;all(NULL)
  #12 /home/sitename/vendor/craftcms/cms/src/services/Categories.php(147): yii\db\ActiveQuery-&gt;all()
  #13 /home/sitename/vendor/craftcms/cms/src/services/Categories.php(168): craft\services\Categories-&gt;getAllGroups()
  #14 /home/sitename/vendor/craftcms/cms/src/web/assets/cp/CpAsset.php(304): craft\services\Categories-&gt;getEditableGroups()
  #15 /home/sitename/vendor/craftcms/cms/src/web/assets/cp/CpAsset.php(240): craft\web\assets\cp\CpAsset-&gt;_editableCategoryGroups()
  #16 /home/sitename/vendor/craftcms/cms/src/web/assets/cp/CpAsset.php(91): craft\web\assets\cp\CpAsset-&gt;_craftData()
  #17 /home/sitename/vendor/yiisoft/yii2/web/View.php(266): craft\web\assets\cp\CpAsset-&gt;registerAssetFiles(Object(craft\web\View))
  #18 /home/sitename/vendor/craftcms/cms/src/web/View.php(1476): yii\web\View-&gt;registerAssetFiles('craft\\web\\asset...')
  #19 /home/sitename/vendor/yiisoft/yii2/web/View.php(264): craft\web\View-&gt;registerAssetFiles('craft\\web\\asset...')
  #20 /home/sitename/vendor/craftcms/cms/src/web/View.php(1476): yii\web\View-&gt;registerAssetFiles('spicyweb\\embedd...')
  #21 /home/sitename/vendor/yiisoft/yii2/web/View.php(162): craft\web\View-&gt;registerAssetFiles('spicyweb\\embedd...')
  #22 /home/sitename/vendor/craftcms/cms/src/web/View.php(870): yii\web\View-&gt;endBody()
  #23 /home/sitename/storage/runtime/compiled_templates/09/099ec019af86e34b9ea9f63b2dbac8d74176f8466496d8a2425bb84f3bec877f.php(66): craft\web\View-&gt;endBody()
  #24 /home/sitename/vendor/twig/twig/lib/Twig/Template.php(386): __TwigTemplate_9aa2dcb82b219a2fa85db09c73326448a71cbe86b0372bc433523ac598499391-&gt;doDisplay(Array, Array)
  #25 /home/sitename/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template-&gt;displayWithErrorHandling(Array, Array)
  #26 /home/sitename/vendor/twig/twig/lib/Twig/Template.php(363): craft\web\twig\Template-&gt;displayWithErrorHandling(Array, Array)
  #27 /home/sitename/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&gt;display(Array, Array)
  #28 /home/sitename/storage/runtime/compiled_templates/09/091b800fabb88c3d6e62016f577589ccd5e7c12aa48a1467f1257ce83d37d043.php(40): craft\web\twig\Template-&gt;display(Array, Array)
  #29 /home/sitename/vendor/twig/twig/lib/Twig/Template.php(386): __TwigTemplate_0e919918d332266787684ee1ea6d42db967f13e4cb8da3aeadda81eec7091361-&gt;doDisplay(Array, Array)
  #30 /home/sitename/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template-&gt;displayWithErrorHandling(Array, Array)
  #31 /home/sitename/vendor/twig/twig/lib/Twig/Template.php(363): craft\web\twig\Template-&gt;displayWithErrorHandling(Array, Array)
  #32 /home/sitename/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&gt;display(Array, Array)
  #33 /home/sitename/storage/runtime/compiled_templates/e9/e93cb237d31ded69afdaf6d6597608b057cf095c8b34c5fa7bdbe9d90ed6bd25.php(55): craft\web\twig\Template-&gt;display(Array, Array)
  #34 /home/sitename/vendor/twig/twig/lib/Twig/Template.php(386): __TwigTemplate_5707e1b3f57ed73779ccae5f2a7fa1e6916724c0d2e401b30a13dba031a03c95-&gt;doDisplay(Array, Array)
  #35 /home/sitename/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template-&gt;displayWithErrorHandling(Array, Array)
  #36 /home/sitename/vendor/twig/twig/lib/Twig/Template.php(363): craft\web\twig\Template-&gt;displayWithErrorHandling(Array, Array)
  #37 /home/sitename/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template-&gt;display(Array, Array)
  #38 /home/sitename/vendor/twig/twig/lib/Twig/Template.php(371): craft\web\twig\Template-&gt;display(Array)
  #39 /home/sitename/vendor/twig/twig/lib/Twig/Environment.php(289): Twig_Template-&gt;render(Array)
  #40 /home/sitename/vendor/craftcms/cms/src/web/View.php(331): Twig_Environment-&gt;render('login', Array)
  #41 /home/sitename/vendor/craftcms/cms/src/web/View.php(378): craft\web\View-&gt;renderTemplate('login', Array)
  #42 /home/sitename/vendor/craftcms/cms/src/web/Controller.php(156): craft\web\View-&gt;renderPageTemplate('login', Array)
  #43 /home/sitename/vendor/craftcms/cms/src/controllers/TemplatesController.php(78): craft\web\Controller-&gt;renderTemplate('login', Array)
  #44 [internal function]: craft\controllers\TemplatesController-&gt;actionRender('login', Array)
  #45 /home/sitename/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
  #46 /home/sitename/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction-&gt;runWithParams(Array)
  #47 /home/sitename/vendor/craftcms/cms/src/web/Controller.php(104): yii\base\Controller-&gt;runAction('render', Array)
  #48 /home/sitename/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&gt;runAction('render', Array)
  #49 /home/sitename/vendor/craftcms/cms/src/web/Application.php(284): yii\base\Module-&gt;runAction('templates/rende...', Array)
  #50 /home/sitename/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application-&gt;runAction('templates/rende...', Array)
  #51 /home/sitename/vendor/craftcms/cms/src/web/Application.php(273): yii\web\Application-&gt;handleRequest(Object(craft\web\Request))
  #52 /home/sitename/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&gt;handleRequest(Object(craft\web\Request))
  #53 /home/sitename/public_html/index.php(21): yii\base\Application-&gt;run()
  #54 {main}
  </code></pre>
  
Tags: <craft3><database><error>
Title: Craft CMS admin intermittent internal server errors
ThreadText: # Craft CMS admin intermittent internal server errors
  
  (Asked by: username_0 on 2021-11-24)
  
  I'm getting intermittent Internal server errors in Craft admin.
  
  This has happened out of the blue on an active site. Craft pro 3.041
  
  phperrors.log:
  
  ```
  PHP Notice:  Undefined index: constraint_name in /home/sitename/vendor/yiisoft/yii2/db/mysql/Schema.php on line 387
  PHP Notice:  Undefined index: referenced_table_name in /home/sitename/vendor/yiisoft/yii2/db/mysql/Schema.php on line 387
  PHP Notice:  Undefined index: constraint_name in /home/sitename/vendor/yiisoft/yii2/db/mysql/Schema.php on line 388
  PHP Notice:  Undefined index: column_name in /home/sitename/vendor/yiisoft/yii2/db/mysql/Schema.php on line 388
  PHP Notice:  Undefined index: referenced_column_name in /home/sitename/vendor/yiisoft/yii2/db/mysql/Schema.php on line 388
  
  ```
  
  stack trace:
  
  ```
  yii\base\ErrorException: Undefined index: constraint_name in /home/sitename/vendor/yiisoft/yii2/db/mysql/Schema.php:387
  Stack trace:
  #0 /home/sitename/vendor/craftcms/cms/src/web/ErrorHandler.php(76): yii\base\ErrorHandler->handleError(8, 'Undefined index...', '/home/libraries...', 387)
  #1 /home/sitename/vendor/yiisoft/yii2/db/mysql/Schema.php(387): craft\web\ErrorHandler->handleError(8, 'Undefined index...', '/home/libraries...', 387, Array)
  #2 /home/sitename/vendor/craftcms/cms/src/db/mysql/Schema.php(260): yii\db\mysql\Schema->findConstraints(Object(craft\db\TableSchema))
  #3 /home/sitename/vendor/craftcms/cms/src/db/mysql/Schema.php(244): craft\db\mysql\Schema->findConstraints(Object(craft\db\TableSchema))
  #4 /home/sitename/vendor/yiisoft/yii2/db/Schema.php(744): craft\db\mysql\Schema->loadTableSchema('categorygroups')
  #5 /home/sitename/vendor/yiisoft/yii2/db/Schema.php(194): yii\db\Schema->getTableMetadata('{{%categorygrou...', 'schema', false)
  #6 /home/sitename/vendor/yiisoft/yii2/db/ActiveRecord.php(384): yii\db\Schema->getTableSchema('{{%categorygrou...')
  #7 /home/sitename/vendor/yiisoft/yii2/db/ActiveRecord.php(458): yii\db\ActiveRecord::getTableSchema()
  #8 /home/sitename/vendor/yiisoft/yii2/db/ActiveQueryTrait.php(123): yii\db\ActiveRecord::populateRecord(Object(craft\records\CategoryGroup), Array)
  #9 /home/sitename/vendor/yiisoft/yii2/db/ActiveQuery.php(207): yii\db\ActiveQuery->createModels(Array)
  #10 /home/sitename/vendor/yiisoft/yii2/db/Query.php(238): yii\db\ActiveQuery->populate(Array)
  #11 /home/sitename/vendor/yiisoft/yii2/db/ActiveQuery.php(133): yii\db\Query->all(NULL)
  #12 /home/sitename/vendor/craftcms/cms/src/services/Categories.php(147): yii\db\ActiveQuery->all()
  #13 /home/sitename/vendor/craftcms/cms/src/services/Categories.php(168): craft\services\Categories->getAllGroups()
  #14 /home/sitename/vendor/craftcms/cms/src/web/assets/cp/CpAsset.php(304): craft\services\Categories->getEditableGroups()
  #15 /home/sitename/vendor/craftcms/cms/src/web/assets/cp/CpAsset.php(240): craft\web\assets\cp\CpAsset->_editableCategoryGroups()
  #16 /home/sitename/vendor/craftcms/cms/src/web/assets/cp/CpAsset.php(91): craft\web\assets\cp\CpAsset->_craftData()
  #17 /home/sitename/vendor/yiisoft/yii2/web/View.php(266): craft\web\assets\cp\CpAsset->registerAssetFiles(Object(craft\web\View))
  #18 /home/sitename/vendor/craftcms/cms/src/web/View.php(1476): yii\web\View->registerAssetFiles('craft\\web\\asset...')
  #19 /home/sitename/vendor/yiisoft/yii2/web/View.php(264): craft\web\View->registerAssetFiles('craft\\web\\asset...')
  #20 /home/sitename/vendor/craftcms/cms/src/web/View.php(1476): yii\web\View->registerAssetFiles('spicyweb\\embedd...')
  #21 /home/sitename/vendor/yiisoft/yii2/web/View.php(162): craft\web\View->registerAssetFiles('spicyweb\\embedd...')
  #22 /home/sitename/vendor/craftcms/cms/src/web/View.php(870): yii\web\View->endBody()
  #23 /home/sitename/storage/runtime/compiled_templates/09/099ec019af86e34b9ea9f63b2dbac8d74176f8466496d8a2425bb84f3bec877f.php(66): craft\web\View->endBody()
  #24 /home/sitename/vendor/twig/twig/lib/Twig/Template.php(386): __TwigTemplate_9aa2dcb82b219a2fa85db09c73326448a71cbe86b0372bc433523ac598499391->doDisplay(Array, Array)
  #25 /home/sitename/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template->displayWithErrorHandling(Array, Array)
  #26 /home/sitename/vendor/twig/twig/lib/Twig/Template.php(363): craft\web\twig\Template->displayWithErrorHandling(Array, Array)
  #27 /home/sitename/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template->display(Array, Array)
  #28 /home/sitename/storage/runtime/compiled_templates/09/091b800fabb88c3d6e62016f577589ccd5e7c12aa48a1467f1257ce83d37d043.php(40): craft\web\twig\Template->display(Array, Array)
  #29 /home/sitename/vendor/twig/twig/lib/Twig/Template.php(386): __TwigTemplate_0e919918d332266787684ee1ea6d42db967f13e4cb8da3aeadda81eec7091361->doDisplay(Array, Array)
  #30 /home/sitename/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template->displayWithErrorHandling(Array, Array)
  #31 /home/sitename/vendor/twig/twig/lib/Twig/Template.php(363): craft\web\twig\Template->displayWithErrorHandling(Array, Array)
  #32 /home/sitename/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template->display(Array, Array)
  #33 /home/sitename/storage/runtime/compiled_templates/e9/e93cb237d31ded69afdaf6d6597608b057cf095c8b34c5fa7bdbe9d90ed6bd25.php(55): craft\web\twig\Template->display(Array, Array)
  #34 /home/sitename/vendor/twig/twig/lib/Twig/Template.php(386): __TwigTemplate_5707e1b3f57ed73779ccae5f2a7fa1e6916724c0d2e401b30a13dba031a03c95->doDisplay(Array, Array)
  #35 /home/sitename/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template->displayWithErrorHandling(Array, Array)
  #36 /home/sitename/vendor/twig/twig/lib/Twig/Template.php(363): craft\web\twig\Template->displayWithErrorHandling(Array, Array)
  #37 /home/sitename/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template->display(Array, Array)
  #38 /home/sitename/vendor/twig/twig/lib/Twig/Template.php(371): craft\web\twig\Template->display(Array)
  #39 /home/sitename/vendor/twig/twig/lib/Twig/Environment.php(289): Twig_Template->render(Array)
  #40 /home/sitename/vendor/craftcms/cms/src/web/View.php(331): Twig_Environment->render('login', Array)
  #41 /home/sitename/vendor/craftcms/cms/src/web/View.php(378): craft\web\View->renderTemplate('login', Array)
  #42 /home/sitename/vendor/craftcms/cms/src/web/Controller.php(156): craft\web\View->renderPageTemplate('login', Array)
  #43 /home/sitename/vendor/craftcms/cms/src/controllers/TemplatesController.php(78): craft\web\Controller->renderTemplate('login', Array)
  #44 [internal function]: craft\controllers\TemplatesController->actionRender('login', Array)
  #45 /home/sitename/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
  #46 /home/sitename/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
  #47 /home/sitename/vendor/craftcms/cms/src/web/Controller.php(104): yii\base\Controller->runAction('render', Array)
  #48 /home/sitename/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('render', Array)
  #49 /home/sitename/vendor/craftcms/cms/src/web/Application.php(284): yii\base\Module->runAction('templates/rende...', Array)
  #50 /home/sitename/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('templates/rende...', Array)
  #51 /home/sitename/vendor/craftcms/cms/src/web/Application.php(273): yii\web\Application->handleRequest(Object(craft\web\Request))
  #52 /home/sitename/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
  #53 /home/sitename/public_html/index.php(21): yii\base\Application->run()
  #54 {main}
  
  ```
  
  **Tags:** craft3, database, error
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-11-24. Score: 2
  
  This sounds like an old bug that was fixed in a more recent version of Craft than the one you are on - <https://github.com/craftcms/cms/issues/6379>
  
  Are you able to update Craft and your plugins to the latest version?
  
  
  ---
  
  