Zsh: corrupt history file

Hi there, it is my second day my with the distro, i have this problem “zsh: corrupt history file /home/triasirax /.zsh_history”
i found this quick solution on internet

mv .zsh_history .zsh_history_bad
strings .zsh_history_bad > .zsh_history
fc -R .zsh_history

it works but not permanently, it happens like in every 30 minutes and it is frustrating. Why is this happening? and what is the permanent solution of it?

Hello,
try to post your .zshrc too.
translated with google translate.:smile:

here you are

# Zshrc

# not running interactively then bail
[[ $- != *i* ]] && return

# shell opts
setopt auto_cd
setopt bang_hist
setopt completealiases
setopt extended_history
setopt hist_ignore_all_dups
setopt hist_find_no_dups
setopt inc_append_history
setopt share_history

# alias
alias l='ls'
alias la='ls -A'
alias ll='ls -lA'
alias ls='ls --color=auto'
alias upd='sudo pacman -Syyu'
alias pac='sudo pacman --color auto'
alias merge='xrdb -merge ~/.Xresources'
alias grubup='sudo grub-mkconfig -o /boot/grub/grub.cfg'
alias mirrors='sudo reflector --score 100 --fastest 25 --sort rate --save /etc/pacman.d/mirrorlist --verbose'
alias nvidiaon='sudo tee /proc/acpi/bbswitch <<< ON'
alias nvidiaoff='sudo tee /proc/acpi/bbswitch <<< OFF'
alias trq='setxkbmap -layout tr'
al-info

Can you try changing these lines in .zshrc

# remove these
setopt auto_cd
setopt bang_hist
setopt completealiases
setopt extended_history
setopt hist_ignore_all_dups
setopt hist_find_no_dups
setopt inc_append_history
setopt share_history

# add these in place
setopt autocd
setopt completealiases
setopt histignorealldups
setopt histfindnodups
setopt incappendhistory
setopt sharehistory

I think this maybe just boils down to a typo, though I’m not sure, we have been using this zshrc for quite some time without issues. Make sure to delete your old history file.

Lemme know if it works,

Cheers