slackhq/nebula · warning
ErrHeaderTooShort
ErrHeaderTooShort
Error message
header is too short
What it means
ErrHeaderTooShort is returned by H.Parse (and Parse) when the input byte slice is shorter than the fixed header Len. Nebula packet headers are fixed-size, so any shorter buffer cannot possibly contain a valid header.
Source
Thrown at header/header.go:67
Control: "control",
}
const (
MessageNone MessageSubType = 0
MessageRelay MessageSubType = 1
)
const (
TestRequest MessageSubType = 0
TestReply MessageSubType = 1
)
const (
HandshakeIXPSK0 MessageSubType = 0
HandshakeXXPSK0 MessageSubType = 1
)
var ErrHeaderTooShort = errors.New("header is too short")
var subTypeTestMap = map[MessageSubType]string{
TestRequest: "testRequest",
TestReply: "testReply",
}
var subTypeNoneMap = map[MessageSubType]string{0: "none"}
var subTypeMap = map[MessageType]*map[MessageSubType]string{
Message: {
MessageNone: "none",
MessageRelay: "relay",
},
RecvError: &subTypeNoneMap,
LightHouse: &subTypeNoneMap,
Test: &subTypeTestMap,
CloseTunnel: &subTypeNoneMap,
Handshake: {View on GitHub (pinned to dd8f660c0a)
Solutions
- Verify the read buffer is at least header.Len bytes and you pass the entire datagram to Parse
- Treat the packet as garbage and drop it — the manager ignores undecodable datagrams
- If truncation is systematic, check for MTU/fragmentation problems on the network path
Example fix
// before
b := buf[:20] // truncated copy
err := h.Parse(b)
// after
if len(buf) < header.Len {
return // drop undecodable packet
}
err := h.Parse(buf) Defensive patterns
Strategy: validation
Validate before calling
func canParseHeader(b []byte) bool {
return len(b) >= header.Len
} Try / catch
var h header.H
if err := h.Parse(b); err != nil {
if errors.Is(err, header.ErrHeaderTooShort) {
// drop garbage/truncated datagram
return
}
return err
} Prevention
- Read at least header.Len bytes before parsing
- Parse the full datagram, never a sub-slice of the payload
- Drop undecodable datagrams silently; they're usually network noise
When it happens
Trigger: Calling h.Parse(b) at header/header.go:145 with len(b) < Len — e.g. a truncated UDP datagram, garbage datagram, or a slice handed to the wrong parse layer.
Common situations: Random internet noise arriving on the open UDP port; truncated packets from an undersized read buffer or MTU issue; feeding payload bytes (instead of the full packet) into Parse.
Related errors
AI-assisted analysis of slackhq/nebula@dd8f660c0a (2026-09-03).
Data as JSON: /api/errors/e9855789c7527468.
Report an issue: GitHub.