tulir / gomuks

A terminal based Matrix client written in Go.
https://maunium.net/go/gomuks
GNU Affero General Public License v3.0
1.3k stars 124 forks source link

Hard power cycle on machine leaves `auth-cache.yaml` corrupted? #421

Open goodboy opened 1 year ago

goodboy commented 1 year ago
failed to load auth-cache.yaml: yaml: unmarshal errors:
  line 6: mapping key "initial_sync_done" already defined at line 4
goroutine 1 [running]:
runtime/debug.Stack()
    /usr/lib/go/src/runtime/debug/stack.go:24 +0x65
maunium.net/go/gomuks/debug.PrettyPanic({0xfa59a0, 0xc00042d160})
    /home/goodboy/repos/gomuks/debug/debug.go:133 +0x19a
maunium.net/go/gomuks/debug.Recover()
    /home/goodboy/repos/gomuks/debug/debug.go:107 +0x5a
panic({0xfa59a0, 0xc00042d160})
    /usr/lib/go/src/runtime/panic.go:884 +0x213
maunium.net/go/gomuks/config.(*Config).LoadAuthCache(0xc0001578c0?)
    /home/goodboy/repos/gomuks/config/config.go:290 +0xa5
maunium.net/go/gomuks/config.(*Config).LoadAll(0xc0001578c0)
    /home/goodboy/repos/gomuks/config/config.go:200 +0x1b8
main.NewGomuks(0x114fe78, {0xc00002f7e0, 0x1c}, {0xc00002ca20, 0x21}, {0xc00002f820, 0x1b}, {0xc00002ab40, 0x17})
    /home/goodboy/repos/gomuks/gomuks.go:88 +0x191
main.main()
    /home/goodboy/repos/gomuks/main.go:106 +0x65e

Can't get the program to start any more 😂

Where is the file I should wipe to make this work!?

goodboy commented 1 year ago
>>> locate auth-cache
/home/goodboy/.cache/gomuks/auth-cache.yaml

Had to wipe a couple lines and i'm back up and running.

I think maybe dumping the abs path to that file would be handy so the user knows immediately what's the cause of the issue?

ForceFaction commented 1 year ago

Hard power cycling any machine always poses the risk of corrupting files which are still opened and which may have some unflushed contents in RAM. So the fact that a cache file may be corrupted is perfectly expected, isn't it?

Now, it's a cache file. If it's corrupted i'd just delete it.

ForceFaction commented 1 year ago

In case you are unsure which file is causing the problem; looking under $XDG_CACHE_DIR and seeing if there are any files relating to the crashing program, is always worth a try.