commaai/openpilot · warning

signal %s out of bounds.start_bit: %d size: %d

Error message

signal %s out of bounds.start_bit: %d size: %d

What it means

Printed by BinaryViewModel::refresh() in cabana's binary view when a DBC signal, mapped to its bit positions, lands past the end of the message's byte grid — i.e. start_bit + size extends beyond dbc_msg->size bytes. The offending signal's remaining bits are skipped (break) and refresh continues, so it is a diagnostic for an inconsistent DBC rather than a crash.

Source

Thrown at openpilot/tools/cabana/binaryview.cc:264

  int size = is_lb ? std::abs(cur_bit_pos - anchor_bit_pos) + 1 : std::abs(flipBitPos(cur_bit_pos) - flipBitPos(anchor_bit_pos)) + 1;
  return {start_bit, size, is_lb};
}

// BinaryViewModel

void BinaryViewModel::refresh() {
  beginResetModel();
  bit_flip_tracker = {};
  items.clear();
  if (auto dbc_msg = dbc()->msg(msg_id)) {
    row_count = dbc_msg->size;
    items.resize(row_count * column_count);
    for (auto sig : dbc_msg->getSignals()) {
      for (int j = 0; j < sig->size; ++j) {
        int pos = sig->is_little_endian ? flipBitPos(sig->start_bit + j) : flipBitPos(sig->start_bit) + j;
        int idx = column_count * (pos / 8) + pos % 8;
        if (idx >= items.size()) {
          fprintf(stderr, "signal %s out of bounds.start_bit: %d size: %d\n",
                  sig->name.c_str(), sig->start_bit, sig->size);
          break;
        }
        if (j == 0) sig->is_little_endian ? items[idx].is_lsb = true : items[idx].is_msb = true;
        if (j == sig->size - 1) sig->is_little_endian ? items[idx].is_msb = true : items[idx].is_lsb = true;

        auto &sigs = items[idx].sigs;
        sigs.push_back(sig);
        if (sigs.size() > 1) {
          std::sort(sigs.begin(), sigs.end(), [](auto l, auto r) { return l->size > r->size; });
        }
      }
    }
  } else {
    row_count = can->lastMessage(msg_id).dat.size();
    items.resize(row_count * column_count);
  }
  endResetModel();

View on GitHub (pinned to 516ec1e682)

Solutions

  1. Open the DBC and check the flagged signal's start_bit and size against its message's declared byte length; enlarge the BO_ length or fix the signal bounds.
  2. Watch endianness: for Motorola/big-endian signals start_bit is the MSB position — a wrong endianness flag makes computed positions run off the end.
  3. If the DBC came from a converter (canmatrix etc.), re-export with correct start-bit semantics.
  4. Reload the fixed DBC in cabana (--dbc file) and confirm the binary view renders all signals without the stderr line.

Example fix

# before
BO_ 100 driverControls: 8 driver
 SG_ steerCommand : 55|16@1- ...   # needs bits 55..70 -> beyond 8 bytes

# after
BO_ 100 driverControls: 10 driver
 SG_ steerCommand : 55|16@1- ...   # message length covers the signal
Defensive patterns

Strategy: validation

Validate before calling

def signal_fits(signal, msg_size_bytes):
    # little-endian: highest bit touched = start_bit + size - 1; Motorola: MSB-first via flipBitPos
    if signal.is_little_endian:
        return (signal.start_bit + signal.size + 7) // 8 <= msg_size_bytes
    start_byte = (signal.start_bit // 8)
    end_bit = (start_byte * 8) + (7 - (signal.start_bit % 8)) + signal.size - 1
    return (end_bit // 8) + 1 <= msg_size_bytes

Prevention

When it happens

Trigger: Loading a DBC where a message's declared length (size) is smaller than its largest signal requires — e.g. message length 8 but a signal starting at bit 55 with size 16. Bit position math: for little-endian, flipBitPos(start_bit + j); for big-endian, flipBitPos(start_bit) + j; if the resulting byte index exceeds size, this fires. Overlapping/late-added signals to a DBC without bumping the message length also trigger it.

Common situations: Community DBCs edited by hand where a signal was appended but the message BO_ length was never increased, wrong-endian start_bit values from a dbc conversion tool, or a DBC written for a longer variant of a message applied to a shorter one.

Related errors


AI-assisted analysis of commaai/openpilot@516ec1e682 (2026-08-15). Data as JSON: /api/errors/df8c064a4e0683a3. Report an issue: GitHub.