# Buggy code
def append(self, cmd):
    if not self.remember_history:
        return
    envs = builtins.__xonsh__.env
    inp = cmd["inp"].rstrip()
    self.inps.append(inp)
    self.outs.append(cmd.get("out"))
    self.rtns.append(cmd["rtn"])
    self.tss.append(cmd.get("ts", (None, None)))

    opts = envs.get("HISTCONTROL")
    if "ignoredups" in opts and inp == self._last_hist_inp:
        # Skipping dup cmd
        return
    if "ignoreerr" in opts and cmd["rtn"] != 0:
        # Skipping failed cmd
        return
    if "ignorespace" in opts and cmd.get("spc"):
        # Skipping cmd starting with space
        return

    try:
        del cmd["spc"]
    except KeyError:
        pass
    self._last_hist_inp = inp
    xh_sqlite_append_history(
        cmd,
        str(self.sessionid),
        store_stdout=envs.get("XONSH_STORE_STDOUT", False),
        filename=self.filename,
        remove_duplicates=("erasedups" in opts),
    )


# Traceback (sqlite3.OperationalError)
Traceback (most recent call last):
File "/opt/miniconda/lib/python3.8/site-packages/xonsh/main.py", line 421, in main
sys.exit(main_xonsh(args))
File "/opt/miniconda/lib/python3.8/site-packages/xonsh/main.py", line 459, in main_xonsh
shell.shell.cmdloop()
File "/opt/miniconda/lib/python3.8/site-packages/xonsh/ptk_shell/shell.py", line 344, in cmdloop
self.default(line, raw_line)
File "/opt/miniconda/lib/python3.8/site-packages/xonsh/base_shell.py", line 389, in default
self._append_history(
File "/opt/miniconda/lib/python3.8/site-packages/xonsh/base_shell.py", line 429, in _append_history
hist.append(info)
File "/opt/miniconda/lib/python3.8/site-packages/xonsh/history/sqlite.py", line 275, in append
xh_sqlite_append_history(
File "/opt/miniconda/lib/python3.8/site-packages/xonsh/history/sqlite.py", line 172, in xh_sqlite_append_history
_xh_sqlite_insert_command(c, cmd, sessionid, store_stdout, remove_duplicates)
File "/opt/miniconda/lib/python3.8/site-packages/xonsh/history/sqlite.py", line 123, in _xh_sqlite_insert_command
values["frequency"] = _xh_sqlite_erase_dups(cursor, values["inp"]) + 1
File "/opt/miniconda/lib/python3.8/site-packages/xonsh/history/sqlite.py", line 91, in _xh_sqlite_erase_dups
cursor.execute(sql, (input,))
sqlite3.OperationalError: database or disk is full
Xonsh encountered an issue during launch
Failback to /bin/bash
(base) pc@pc:~$

# Fixed code
def append(self, cmd):
    if not self.remember_history:
        return
    envs = builtins.__xonsh__.env
    inp = cmd["inp"].rstrip()
    self.inps.append(inp)
    self.outs.append(cmd.get("out"))
    self.rtns.append(cmd["rtn"])
    self.tss.append(cmd.get("ts", (None, None)))

    opts = envs.get("HISTCONTROL")
    if "ignoredups" in opts and inp == self._last_hist_inp:
        # Skipping dup cmd
        return
    if "ignoreerr" in opts and cmd["rtn"] != 0:
        # Skipping failed cmd
        return
    if "ignorespace" in opts and cmd.get("spc"):
        # Skipping cmd starting with space
        return

    try:
        del cmd["spc"]
    except KeyError:
        pass
    self._last_hist_inp = inp
    try:
        xh_sqlite_append_history(
            cmd,
            str(self.sessionid),
            store_stdout=envs.get("XONSH_STORE_STDOUT", False),
            filename=self.filename,
            remove_duplicates=("erasedups" in opts),
        )
    except sqlite3.OperationalError as err:
        print(f"SQLite History Backend Error: {err}")