AlexxIT/go2rtc · error
eseecloud: wrong start byte
Error message
eseecloud: wrong start byte
What it means
eseecloud.readPacket (pkg/eseecloud/eseecloud.go:163) reads a packet header via io.ReadFull and requires the first byte to be '$'. If b[0] != '$' it returns "eseecloud: wrong start byte", meaning the TCP stream is no longer aligned with the EseeCloud packet framing or the peer is not speaking the EseeCloud protocol.
Solutions
- Reconnect (restart Start/probe): once the stream is misaligned, the framing cannot recover in place.
- Verify the host and port actually serve the EseeCloud protocol (captured packets should start with '$').
- Rule out middleboxes or relays replacing the payload (HTML error pages, captive portals).
- Check device firmware compatibility; a protocol change can alter the framing.
- Capture traffic to inspect the exact bytes arriving when the error occurs.
Example fix
// before: keep reading after desync
for {
pkt, err := p.readPacket() // wrong start byte repeats
}
// after: rebuild the connection
if err != nil {
p.Close()
err = p.Start(ctx) // fresh TCP session, resynced framing
} Defensive patterns
Strategy: fallback
Try / catch
pkt, err := p.readPacket()
if err != nil && strings.HasSuffix(err.Error(), "wrong start byte") {
p.Close()
err = p.Start(ctx) // resync requires a new session
} Prevention
- Restart the session on any framing error
- Confirm the port serves EseeCloud ('$'-framed packets)
- Avoid relays/proxies that can inject data
- Watch for device-side resets and reconnect quickly
When it happens
Trigger: readPacket, invoked by Start and probe, when the first byte of a packet is not '$' — desynced stream after a partial read, garbage injected mid-session, or a non-EseeCloud service on the port.
Common situations: Device or cloud relay resetting the connection and sending an error page/HTML instead of framed packets; wrong host/port (connecting to camera HTTP UI instead of the EseeCloud stream port); leftover partial packet from a previous error desynchronizing the reader.
Understand the failure class
Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.
Related errors
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/ef4cb5d054b2e80c.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/eseecloud/eseecloud.go:163
Timestamp: uint32(uint64(pkt.Timestamp) * 8000 / 1000000),
},
Payload: pkt.Payload,
}
}
recv.WriteRTP(pkt)
}
}
}
func (p *Producer) readPacket() (*core.Packet, error) {
b := make([]byte, 8)
if _, err := io.ReadFull(p.rd, b); err != nil {
return nil, err
}
if b[0] != '$' {
return nil, errors.New("eseecloud: wrong start byte")
}
size := binary.BigEndian.Uint32(b[4:])
b = make([]byte, size)
if _, err := io.ReadFull(p.rd, b); err != nil {
return nil, err
}
pkt := &core.Packet{}
if err := pkt.Unmarshal(b); err != nil {
return nil, err
}
p.Recv += int(size)
return pkt, nil
}
View on GitHub (pinned to c245815e75)