Error on installation: The state 'draft' already exists in workflow
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3571188. --> Reported by: [svendecabooter](https://www.drupal.org/user/35369) Related to !59 !51 >>> <p>[Tracker]<br> <strong>Update Summary: </strong>Workflow-states related error upon installation<br> <strong>Check-in Date: </strong>MM/DD/YYYY<br> <strong>Blocked by: </strong>[#XXXXXX] (New issues on new lines)<br> <strong>Additional Collaborators: </strong> @username1, @username2<br> <em>Metadata is used by the <a href="https://www.drupalstarforge.ai/" title="AI Tracker">AI Tracker.</a> Docs and additional fields <a href="https://www.drupalstarforge.ai/ai-dashboard/docs" title="AI Issue Tracker Documentation">here</a>.</em><br> [/Tracker]</p> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>I have checked out the 1.0.x branch of this module, for development purposes.<br> Upon installation of the module and its dependencies, I get the following error:</p> <p><code>InvalidArgumentException: The state 'draft' already exists in workflow. in Drupal\workflows\Plugin\WorkflowTypeBase-&gt;addState() (line 104 of core/modules/workflows/src/Plugin/WorkflowTypeBase.php).</code></p> <p>This was on a fresh Drupal installation, with no apparent other modules interfering.</p> <h3 id="testing-steps">How to test</h3> <pre>mkdir my-drupal-site &amp;&amp; cd my-drupal-site<br>ddev config --project-type=drupal11 --docroot=web<br>ddev start<br>ddev composer create-project "drupal/recommended-project:^11"<br>ddev composer update symfony/process --with-all-dependencies (due to security advisory)<br>ddev composer require drush/drush<br>ddev composer require drupal/ai_context:dev-1.0.x<br>ddev drush site:install --account-name=admin --account-pass=admin -y<br>ddev drush en ai_context<br>ddev launch<br># or automatically log in with:<br>ddev launch $(ddev drush uli)<br>go to: /admin/config/workflow/workflows/manage/basic_editorial</pre><p>You will get install error without this MR.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p><strong>NOTE: The workflow module has draft and published states OOTB, so these should not be created.</strong></p> <p>Rework the code to take this into consideration, and update the settings to match Drupal CMS basic_editorial workflow.</p> <h3 id="summary-remaining-tasks">Target date or deadline</h3> <p>February 4, 2026</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <ul> <li><del>Update code</del></li> <li>Review and test</li> </ul> <h3 id="summary-ai-usage">AI usage (if applicable)</h3> <p>[ ] AI Assisted Issue<br> This issue was generated with AI assistance, but was reviewed and refined by the creator.</p> <p>[ ] AI Assisted Code<br> This code was mainly generated by a human, with AI autocompleting or parts AI generated, but under full human supervision.</p> <p>[ ] AI Generated Code<br> This code was mainly generated by an AI with human guidance, and reviewed, tested, and refined by a human.</p> <p>[ ] Vibe Coded<br> This code was generated by an AI and has only been functionally tested.</p>
issue