title: Session/line number was not unique in database. History logging moved to new session
body: <p>I am running an ipython script on VS code. The file is a .py where I run the jupyter cells using the '# %%' line separator.</p>
  <p>Random cells are giving me this</p>
  <blockquote>
  <p>Session/line number was not unique in database. History logging moved to new session XXX</p>
  </blockquote>
  <p>And the XXX changes every time. The problem is that the code gets frozen and does not finish nor provided the output of the cell.</p>
  <p>All the solutions I have found in SO don't exactly relate or don't solve my problem so far.
  <a href="https://i.stack.imgur.com/Otm8o.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Otm8o.png" alt="enter image description here" /></a></p>