TempStoreException: Couldn't acquire lock to delete item
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3573992. -->
Reported by: [ultimike](https://www.drupal.org/user/51132)
>>>
<p>[Tracker]<br>
<strong>Update Summary: </strong>[One-line status update for stakeholders]<br>
<strong>Short Description: </strong>[One-line issue summary for stakeholders]<br>
<strong>Check-in Date: </strong>MM/DD/YYYY<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>While working on a local site building out some AI functionality, my AI Assistants suddenly stopped working. </p>
<p>There were no entries in the AI Logs suggesting that no LLM calls were being made. </p>
<p>In the Drupal's <em>Recent log messages</em>, I did spot several errors similar to:</p>
<p><code>The chatbot had an error: Couldn't acquire lock to update item '1:assistant_thread_1_7' in 'tempstore.private.ai_assistant_api' temporary storage.</code></p>
<p>and </p>
<p><code>Drupal\Core\TempStore\TempStoreException: Couldn't acquire lock to delete item '1:assistant_thread_1_7' from 'tempstore.private.ai_assistant_api' temporary storage. in Drupal\Core\TempStore\PrivateTempStore->delete() (line 192 of /var/www/html/web/core/lib/Drupal/Core/TempStore/PrivateTempStore.php).</code></p>
<h4 id="summary-steps-reproduce">Steps to reproduce (required for bugs, but not feature requests)</h4>
<p>I am using the AI module version 1.2.8. I have no idea what caused the issue.</p>
<h3 id="summary-proposed-resolution">Resolution</h3>
<p>Ultimately, I cleared out the tempstore using the following commands:</p>
<pre>mysql -e "DELETE FROM semaphore WHERE name LIKE '%assistant_thread%';"<br>mysql -e "DELETE FROM key_value_expire WHERE collection = 'tempstore.private.ai_assistant_api';"</pre><p>After I did this, the assistants started working again. </p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<p>None. I'm just adding this issue in case it can help anyone in the future.</p>
issue