"atuin sync -f" has an error while "atuin sync" does not

Hi

First my setup (main machine):
OS: Manjaro Linux
Shell: fish
Atuin: atuin 17.1.0 with basically the default setup with the default server.

Been working with atuin for some time now across several machines and just noticed today that my main machine seems to have an error when I force a sync as follows;

atuin sync -f
0/0 up/down to record store
Error: Could not fetch history: asked for history from before epoch 0.

Location:
    /usr/src/debug/atuin/atuin-17.1.0/atuin-client/src/api_client.rs:190:13

but a normal sync throws no error as follows;

atuin sync
0/0 up/down to record store
Sync complete! 48407 items in history database, force: false

Am concerned about 2 things.

  1. Is the normal background sync happening since atuin sync is working.
  2. Why would the atuin sync -f fail?

Would be grateful for any pointers on how to fix.

Hey Kysh! Welcome to the forum :blush:

There could be a few reasons for that error, though I’d say if it’s syncing ok atm without -f you’re ok to ignore it - we’re actively working on replacing this sync as there’s a few edge cases where it doesn’t work as well as it should. Auto-sync is the same as running atuin sync manually.

Have you ever used the bash importer? There was a period of about 1 month where it had a bug, and all history imported by it would have the same timestamp. This lead to sync issues, and the introduction of the error you see here.

Otherwise, I’ll bump up the page size on the default server. This can help things a bit :slight_smile:

Thanks for the welcome @ellie

Have always ever used fish with atuin across all my platforms.

Just did another atuin sync -f with the same error. Maybe the page size hadn’t been increased?

Query though, If my data on the server is corrupt can I erase it/clear it? I still have my fish history (outside atuin) on the various machines and can easily import it back into atuin on a fresh start.

Query though, If my data on the server is corrupt can I erase it/clear it? I still have my fish history (outside atuin) on the various machines and can easily import it back into atuin on a fresh start.

I have not tested it myself, but I’ve seen a suggestion that you could delete your account (atuin account delete ?) and then recreate it with the same name.

It has now! Sorry for the delay

Otherwise @arcuru is right, you can delete and re-create the account

Increasing the page size seemed to have worked.

atuin sync -f
0/0 up/down to record store
Sync complete! 49814 items in history database, force: true

Excellent! Glad it’s sorted

If you get the chance, would you be able to run this for me?

sqlite3 ~/.local/share/atuin/history.db "select timestamp, count(1) as c from history group by timestamp having c > 1"

Just checking to see if any of your history has the same timestamp :pray:

Output of the query —> sqlite3 Output - Pastebin.com

Hopefully it makes sense.

Thanks!

Yeah that totally makes sense. For some reason there’s a whole bunch of shell history that has the same timestamp. When this happens, sync isn’t too happy.

Especially when there are more history items with the same timestamp than the page size

I’ll have a look at the Fish importer and see what’s going on here