I got the "LIBNJB panic: chunk_size > remain, going to get whole chunk and see what happens!!" error message from time to time, so i examined the code and noticed that the test on line 1122 of procedure.c in libnjb-2.2.7 compares a signed int with an unsigned int. When something goes wrong in njb3_request_file_chunk (line 1115 of the same file). chunk_size gets set to -1 and the test on 1122 "fails".
Solution could be to move the test at line 1131 up.
When i make that modification myself i no longer have to plug/unplug my device when something goes wrong, but i can simply restart the application.