Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled Error - Index Out of Range #42

Closed
palitu opened this issue May 12, 2018 · 9 comments
Closed

Unhandled Error - Index Out of Range #42

palitu opened this issue May 12, 2018 · 9 comments
Labels
problem Something isn't working

Comments

@palitu
Copy link

palitu commented May 12, 2018

another error that just popped up... this seems to happen after getting data from a xiaomi temp/humidity sensor WSDCGQ01LM.

buffer.js:977
    throw new RangeError('Index out of range');
    ^

RangeError: Index out of range
    at checkOffset (buffer.js:977:11)
    at Buffer.readUInt8 (buffer.js:1015:5)
    at Object.zcl.header (/home/leigh/apps/zigbee2mqtt/node_modules/zcl-packet/lib/zcl.js:73:24)
    at Object.header (/home/leigh/apps/zigbee2mqtt/node_modules/zigbee-shepherd/lib/components/zcl.js:10:32)
    at dispatchIncomingMsg (/home/leigh/apps/zigbee2mqtt/node_modules/zigbee-shepherd/lib/components/af.js:631:29)
    at Controller.incomingMsgHandler (/home/leigh/apps/zigbee2mqtt/node_modules/zigbee-shepherd/lib/components/af.js:714:12)
    at emitOne (events.js:116:13)
    at Controller.emit (events.js:211:7)
    at Object.bridge._areqEventBridge (/home/leigh/apps/zigbee2mqtt/node_modules/zigbee-shepherd/lib/components/event_bridge.js:15:16)
    at CcZnp.<anonymous> (/home/leigh/apps/zigbee2mqtt/node_modules/zigbee-shepherd/lib/components/controller.js:98:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zigbee2mqtt@0.1.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the zigbee2mqtt@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/leigh/.npm/_logs/2018-05-12T03_54_07_130Z-debug.log
@Koenkk Koenkk added the problem Something isn't working label May 12, 2018
@palitu
Copy link
Author

palitu commented May 20, 2018

is there any way around this at the moment? I haven't looked through the error to see how trivial it is (i am also no pro when it comes to this)

Should i remove a device that is causing this?

@ptvoinfo
Copy link
Contributor

This error appears with bad (damaged) data packets. This problem appears periodically with all devices. I've patched node_modules\zigbee-shepherd\node_modules\zcl-packet\lib\zcl.js

zcl.header = function (buf) {
if (!Buffer.isBuffer(buf)) throw new TypeError('header should be a buffer.');

if(buf.length < 3){ return; } //!!! <======== added

Koenkk added a commit to Koenkk/zcl-packet that referenced this issue May 25, 2018
Koenkk added a commit that referenced this issue May 25, 2018
@Koenkk
Copy link
Owner

Koenkk commented May 25, 2018

Check added, thanks! @ptvoinfo

@palitu please let me know if I can close this issue.

@palitu
Copy link
Author

palitu commented May 28, 2018

ahh, nope - just got another one after readding a Mijia motion sensor:

buffer.js:977
    throw new RangeError('Index out of range');
    ^

RangeError: Index out of range
    at checkOffset (buffer.js:977:11)
    at Buffer.readUInt8 (buffer.js:1015:5)
    at Object.zcl.header (/app/node_modules/zcl-packet/lib/zcl.js:73:24)
    at Object.header (/app/node_modules/zigbee-shepherd/lib/components/zcl.js:10:32)
    at dispatchIncomingMsg (/app/node_modules/zigbee-shepherd/lib/components/af.js:631:29)
    at Controller.incomingMsgHandler (/app/node_modules/zigbee-shepherd/lib/components/af.js:714:12)
    at emitOne (events.js:116:13)
    at Controller.emit (events.js:211:7)
    at Object.bridge._areqEventBridge (/app/node_modules/zigbee-shepherd/lib/components/event_bridge.js:15:16)
    at CcZnp.<anonymous> (/app/node_modules/zigbee-shepherd/lib/components/controller.js:98:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zigbee2mqtt@0.1.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the zigbee2mqtt@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-05-28T09_46_37_187Z-debug.log

@palitu
Copy link
Author

palitu commented May 28, 2018

I'm running in a docker container and i'm not sure where to find the detail log file...

@Koenkk
Copy link
Owner

Koenkk commented May 28, 2018

Probably you are not running the latest version.

Your log shows at Object.zcl.header (/app/node_modules/zcl-packet/lib/zcl.js:73:24), this is not possible because there is a comment at this line: https://github.com/Koenkk/zcl-packet/blob/master/lib/zcl.js#L73.

To update your docker container:

docker rm -f ZIGBEE2MQTT_CONTAINER_NAME
docker rmi -f ZIGBEE2MQT_IMAGE_NAME

Now run again, this will pull the last version from hub.docker.com.

@palitu
Copy link
Author

palitu commented May 29, 2018 via email

@palitu
Copy link
Author

palitu commented May 29, 2018 via email

@Koenkk
Copy link
Owner

Koenkk commented May 29, 2018

Ok good, let me know if you encounter this again.

@Koenkk Koenkk closed this as completed May 29, 2018
@Koenkk Koenkk mentioned this issue Jun 5, 2018
4 tasks
qm3ster pushed a commit to zigbeer/zigbeer that referenced this issue Mar 11, 2019
wilmardo pushed a commit to wilmardo/zigbee2mqtt that referenced this issue Sep 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants