{"record":{"id":"cc50b34351b91f3b","repo":"commaai/openpilot","slug":"failed-to-receive","errorCode":null,"errorMessage":"failed to receive\n","messagePattern":"failed to receive\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"openpilot/tools/cabana/streams/pandastream.cc","lineNumber":62,"sourceCode":"}\n\nvoid PandaStream::streamThread() {\n  std::vector<can_frame> raw_can_data;\n\n  while (!exit_) {\n    std::this_thread::sleep_for(std::chrono::milliseconds(1));\n\n    if (!panda->connected()) {\n      fprintf(stderr, \"Connection to panda lost. Attempting reconnect.\\n\");\n      if (!connect()){\n        std::this_thread::sleep_for(std::chrono::milliseconds(1000));\n        continue;\n      }\n    }\n\n    raw_can_data.clear();\n    if (!panda->can_receive(raw_can_data)) {\n      fprintf(stderr, \"failed to receive\\n\");\n      continue;\n    }\n\n    MessageBuilder msg;\n    auto evt = msg.initEvent();\n    auto canData = evt.initCan(raw_can_data.size());\n    for (uint i = 0; i<raw_can_data.size(); i++) {\n      canData[i].setAddress(raw_can_data[i].address);\n      canData[i].setDat(kj::arrayPtr((uint8_t*)raw_can_data[i].dat.data(), raw_can_data[i].dat.size()));\n      canData[i].setSrc(raw_can_data[i].src);\n    }\n\n    handleEvent(capnp::messageToFlatArray(msg));\n\n    panda->send_heartbeat(false);\n  }\n}\n","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/commaai/openpilot/blob/516ec1e68203439a73f340f1d0b3b91eabc626ee/openpilot/tools/cabana/streams/pandastream.cc#L44-L80","documentation":"Emitted by the PandaStream receive thread when panda->can_receive(raw_can_data) returns false while the device still reports connected. It means a bulk CAN read from the panda failed (libusb transfer error) — the message is generic on purpose since the underlying usb library logs the detailed error. The thread `continue`s, so it retries on the next 1 ms tick.","triggerScenarios":"An active panda stream where can_receive() fails: USB transfer error/timeout from the panda (LIBUSB_ERROR_IO/TIMEOUT), device firmware wedged but still enumerated, bus congestion producing oversized/garbled packets the library rejects, or the connection dropping between the connected() check and the read. Because the loop just continues, a persistently failing read prints this in a hot loop.","commonSituations":"Marginal USB link (EMI, long cable, unpowered hub) causing transfer errors; panda firmware crash where enumeration survives but endpoints stall; CAN bus error storm from a bad baud-rate configuration hammering the receive path.","solutions":["Check the libusb/panda layer output just before this message for the actual errno/libusb error code — this line is only the generic symptom.","Rule out the physical layer: shorter/shielded USB cable, powered hub, different port.","Verify CAN bus settings (baud rate per bus in the panda stream dialog) match the vehicle — a misconfigured bus floods errors.","Reflash/Power-cycle the panda if the device is wedged (unplug, replug, confirm with dmesg)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate USB stability before streaming (run lsusb / a short dump with candump-equivalent first).","Match CAN baud rates in the stream dialog to the vehicle to avoid error-storm reads.","Keep panda firmware current; wedged firmware often shows as connected-but-unreadable."],"tags":["panda","can","usb","libusb","receive"],"backgroundTag":null,"analyzedSha":"516ec1e68203439a73f340f1d0b3b91eabc626ee","analyzedAt":"2026-08-15T00:17:37.461Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}