panic: runtime error: index out of range in worker/imap/worker.go

When deleting a large chunk of emails, often times while working through the deletes, aerc will throw an index out of range error. I pinpointed the offending code to be in worker/imap/worker.go:228-229

i := update.SeqNum - 1
uid := w.seqMap[i]

For some reason the update.SeqNum is much larger than the seqMap length. In one example run, len(w.seqMap) == 7 and i == 23. I would patch myself, but I am not completely sure of the underlying issue and would rather avoid a hacky fix.

Assigned to
4 months ago
4 months ago

~rleek 4 months ago

I've been getting this error as well. It happens to me when the program is idle.

~devonrjohnson 4 months ago

Do you know if it is the same section of code causing it? Or is it just another index out of range error? I have not been able to completely reliably reproduce the error, I just know it happens in that section of code when deleting chunks of emails from the *client.ExpungeUpdate case in the handleImapUpdate function.

~rleek 4 months ago

It's the same line. 229 in workers/imap/worker.go

I do have a different client running on my office machine that deletes a bunch of junk emails for the same email box so maybe it's still related to deleting.

~devonrjohnson 4 months ago

If it is the same line, I would expect that to be the case. But I am by no means an expert on the code. I just don't know why else the imap worker would need to expunge messages. Hopefully someone with a little more expertise can help debug.

Register here or Log in to comment, or comment via email.