jquery.terminal: Uncaught TypeError When Calling Bunch of ``echo`` in a Loop
Issue summary
I am just printing a bunch of strings line by line to the terminal using echo and got into this error every time:
null:10460 Uncaught TypeError: Cannot read properties of undefined (reading 'length')
at null:10460:59
at FormatBuffer.forEach (null:1976:17)
at FormatBuffer.flush (null:1982:14)
at ready (null:10414:32)
at DelayQueue.add (null:256:17)
at null:9364:23
at jQuery.fn.init.flush (null:10395:17)
at jQuery.fn.init.flush (null:11486:32)
at null:10781:42
at unpromise (null:1136:20)
It is pointing to this line number 10460 (line 10390 in the source code) => https://github.com/jcubic/jquery.terminal/blob/ef9b63834a9bc2679fae45fd7d308873304016c3/js/jquery.terminal.js#L10390
I don’t think I can re-produce this error. But you can check out the Gif below

Noted: all the white colored string characters come from a serial COM port.
The weird thing is this error ONLY occurs on the 18th index of the for loop.
This error cause the terminal to stop receiving data from the echo method until I type clear in the terminal then everything works again.
I was hoping you can give me some ideas why is the snapshot was undefined at that point, so I can track down what causing this in my end.
Thanks,
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 24 (21 by maintainers)
Commits related to this issue
- fix error on multiple echo #878 — committed to jcubic/jquery.terminal by jcubic 5 months ago
I have a bunch of fixes and features on the devel branch. So I think that I can release now.
The issue is fixed, Please don’t close it. I keep it open until it’s released.
At present, it seems that it is affected by outputLimit, but if I configure this limit but it is less than the total number of rows that may be displayed, will it not work?
I would just try to write code that connect to COM and just use:
You will see what is the output and you will be able to reproduce the error for instance on CodePen.
The reason why it’s better than saving into a file, because you can have undefined values, that may be in the output. If all are text you can save them into a file, or just write or just embed the JSON into the demo.