bettercap/bettercap · error

HID frame injection requires the device type to be detected,

Error message

HID frame injection requires the device type to be detected, try to 'hid.sniff %s' for a few seconds.

What it means

Sentinel error returned by errNoType when frame injection is attempted on a discovered HID device whose type (e.g. Logitech vs Microsoft/Broadcom) has not yet been fingerprinted. The device is known, but its Type field is still unset because no sniffing session has captured identifying traffic.

Source

Thrown at modules/hid/hid_inject.go:34

}

func (mod *HIDRecon) setInjectionMode(address string) error {
	if err := mod.setSniffMode(address, true); err != nil {
		return err
	} else if address == "clear" {
		mod.inInjectMode = false
	} else {
		mod.inInjectMode = true
	}
	return nil
}

func errNoDevice(addr string) error {
	return fmt.Errorf("HID device %s not found, make sure that hid.recon is on and that this device has been discovered", addr)
}

func errNoType(addr string) error {
	return fmt.Errorf("HID frame injection requires the device type to be detected, try to 'hid.sniff %s' for a few seconds.", addr)
}

func errNotSupported(dev *network.HIDDevice) error {
	return fmt.Errorf("HID frame injection is not supported for device type %s", dev.Type.String())
}

func errNoKeyMap(layout string) error {
	return fmt.Errorf("could not find keymap for '%s' layout, supported layouts are: %s", layout, SupportedLayouts())
}

func (mod *HIDRecon) prepInjection() (error, *network.HIDDevice, []*Command) {
	var err error

	if err, mod.sniffType = mod.StringParam("hid.force.type"); err != nil {
		return err, nil, nil
	}

	dev, found := mod.Session.HID.Get(mod.sniffAddr)

View on GitHub (pinned to 8eca2820f3)

Solutions

  1. Run 'hid.sniff <address>' for a few seconds so the device type can be detected
  2. Retry the injection command after the type is shown in the HID view
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at modules/hid/hid_inject.go:34 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of bettercap/bettercap@8eca2820f3 (2026-09-02). Data as JSON: /api/errors/c5839a490c9134e5. Report an issue: GitHub.