c-blake / cligen

Nim library to infer/generate command-line-interfaces / option / argument parsing; Docs at
https://c-blake.github.io/cligen/
ISC License
508 stars 24 forks source link

Weird crash: Error: unhandled exception: index 1 not in 0 .. 0 [IndexError] #101

Closed pb-cdunn closed 5 years ago

pb-cdunn commented 5 years ago
$ ./pb --help
cligen.nim(730)          pb
fatal.nim(37)            sysFatal
Error: unhandled exception: index 1 not in 0 .. 0 [IndexError]

A co-worker keeps seeing this. I cannot reproduce it. We managed to get rid of it by upgrading both Nim and cligen, but it keeps coming back.

I think it might be caused by Nimble not being very clear about what SHA1 is uses for various dependencies. But I was wondering if you've seen this, and if you know for sure how to avoid it.

pb-cdunn commented 5 years ago

Whoa! I just told him to clear the nim-cache, and now it works!

c-blake commented 5 years ago

Yeah. I clear my nim cache pretty obsessively. Not as robust as it could be, but easy to work around.

melMass commented 5 years ago

For anyone coming from google here is where the cache lies:

https://nim-lang.org/docs/nimc.html#generated-c-code-directory

SolitudeSF commented 5 years ago

its https://nim-lang.org/docs/nimc.html#compiler-usage-generated-c-code-directory

tiye commented 3 years ago

Ran into this error as well after I removed nim 1.x installed via brew and installed 1.4.0 via choosenim. Tried to remove ~/.cache but found no help. Switched back to 1.2.8 and working for now.

c-blake commented 3 years ago

Do you have a stack trace with a line number like the original post here from 1.5 years ago? (I.e., the cligen.nim(730) bit?). [] gets used a lot. If I cannot reproduce this, then more detailed bug reports are needed for me to be able to do much. :-/

tiye commented 3 years ago

Not much information:

=>> choosenim 1.4.0
      Info: Version 1.4.0 already selected

=>> nim -v
Nim Compiler Version 1.4.0 [MacOSX: amd64]
Compiled at 2020-10-29
Copyright (c) 2006-2020 by Andreas Rumpf

active boot switches: -d:release

=>> nim c -r --hints:off tests/test_expr.nim
fatal.nim(49)            sysFatal
Error: unhandled exception: index 1 not in 0 .. 0 [IndexDefect]

is there any other command to try for informations?

c-blake commented 3 years ago

Yeah. That also isn't much to go on. Hmm. Is tests/test_expr.nim small?

tiye commented 3 years ago

Yep, quite small https://github.com/Cirru/calcit-runner.nim/blob/master/tests/test_expr.nim .

c-blake commented 3 years ago

Um...That test_expr.nim does not use cligen...Indeed, if I git clone the whole repo and git log -p | grep -i cligen I get empty results suggesting cligen has never been used. So, I'm unsure why you think/thought this to be a cligen issue...

tiye commented 3 years ago

Oh, my mistake, I attached the comment in the wrong repo...