niri-wm/niri · error · anyhow::Error
no mode
Error message
no mode
What it means
When enabling a DRM connector, niri picks a mode with pick_mode(): it first tries an exact non-interlaced match for the configured mode, then the connector's PREFERRED mode, and as a last resort connector.modes().first(). 'no mode' means the KMS connector advertised ZERO modes, so even the last-resort lookup failed and output setup cannot continue. This is almost always a physical/EDID problem (the kernel has no mode list for the connector), not a config typo.
Source
Thrown at src/backend/tty.rs:1291
.unwrap_or_default();
for m in connector.modes() {
trace!("{m:?}");
}
let mut mode = None;
if let Some(modeline) = &config.modeline {
match calculate_drm_mode_from_modeline(modeline) {
Ok(x) => mode = Some(x),
Err(err) => {
warn!("invalid custom modeline; falling back to advertised modes: {err:?}");
}
}
}
let (mode, fallback) = match mode {
Some(x) => (x, false),
None => pick_mode(&connector, config.mode).ok_or_else(|| anyhow!("no mode"))?,
};
if fallback {
let target = config.mode.unwrap();
warn!(
"configured mode {}x{}{} could not be found, falling back to preferred",
target.mode.width,
target.mode.height,
if let Some(refresh) = target.mode.refresh {
format!("@{refresh}")
} else {
String::new()
},
);
}
debug!("picking mode: {mode:?}");
View on GitHub (pinned to 606284464d)
Solutions
- Check what the kernel sees: 'cat /sys/class/drm/card-*-DP-1/modes' and 'edid-decode /sys/class/drm/card-DP-1/edid' — if the modes list is empty or EDID is invalid, reseat the cable/dock or power-cycle the monitor.
- Provide a custom mode that does not depend on advertised modes: a modeline in the output config (computed via calculate_drm_mode_from_modeline) or 'mode custom WxH@refresh' (computed via CVT), both of which bypass pick_mode's dependency on connector.modes().
- If a KVM or dock is involved, plug the display directly to rule it out, and update dock/KVM firmware; for docks known to break EDID, force the EDID via kernel drm_kms_helper edid_firmware parameter.
- Update the kernel/DRM driver and re-test; empty mode lists on connected panels are usually fixed driver-side.
Example fix
// before: connector advertises no modes, startup fails with "no mode"
output DP-1 {
}
// after: supply a modeline so niri computes a mode without advertised modes
output DP-1 {
modeline "241.50 2560 2608 2640 2720 1440 1443 1448 1481 +hsync -vsync"
} Defensive patterns
Strategy: fallback
Validate before calling
// Rust (smithay): check the connector before enabling the output
let modes = connector.modes();
if modes.is_empty() {
warn!("connector {} advertises no modes (EDID read failed?)", connector.interface());
// skip or fall back to a custom/modeline mode computed offline
} Try / catch
let (mode, fallback) = match pick_mode(&connector, config.mode) {
Some(x) => x,
None => {
warn!("no mode on {}; falling back to a computed CVT mode", name);
calculate_mode_cvt(1920, 1080, 60.0) // user-approved default
}
}; Prevention
- After docking/KVM switches, re-check 'cat /sys/class/drm/card-*/modes' before starting the compositor.
- Prefer 'mode WxH@R' or 'mode custom WxH@R' over nothing on flaky connectors — the custom path never consults advertised modes.
- Keep a known-good modeline in the config for docks whose EDID negotiation is unreliable.
- Watch the niri log for the 'no mode' connector name; it identifies which physical port to reseat.
When it happens
Trigger: Calling the output-setup path with a connector whose modes() list is empty: monitor disconnected but connector force-enabled, a KVM switch or docking station that fails the EDID read, a corrupted/missing EDID blob, or a VM's virtual connector with no modes created yet. A configured resolution that merely does not match would only set fallback=true and use the preferred mode, not this error.
Common situations: Monitor/cable/dock flakeliness where DDC/EDID negotiation fails; switching a KVM while the compositor starts; amdgpu/i915 driver bugs or old kernels reporting empty mode lists on eDP/DP; running niri in QEMU without a virtual display with modes; forcing an output on (output-connectors) for a connector with nothing attached.
Related errors
AI-assisted analysis of niri-wm/niri@606284464d (2026-08-16).
Data as JSON: /api/errors/c5cea87ff365956c.
Report an issue: GitHub.