m1k1o/neko · error
unsupported screen rate %d
Error message
unsupported screen rate %d
What it means
ChangeScreenSize detects C.BadValue from the X server, which XRandR returns when the requested refresh rate is not supported for the selected mode, and reports 'unsupported screen rate %d'. The configuration call failed specifically because of the Rate field. Note the code also assigns the generic 'unknown screen configuration' error first, so the BadValue branch overwrites it when it applies.
Source
Thrown at server/pkg/xorg/xorg.go:234
status := C.XSetScreenConfiguration(c_width, c_height, c_rate)
if status != C.RRSetConfigSuccess {
// create new screen configuration
C.XCreateScreenMode(c_width, c_height, c_rate)
// screen configuration should exist now, set it
status = C.XSetScreenConfiguration(c_width, c_height, c_rate)
}
var err error
// if screen configuration was not set successfully, return error
if status != C.RRSetConfigSuccess {
err = fmt.Errorf("unknown screen configuration %s", s.String())
}
// if specified rate is not supported a BadValue error is returned
if status == C.BadValue {
err = fmt.Errorf("unsupported screen rate %d", s.Rate)
}
return s, err
}
func GetScreenSize() types.ScreenSize {
mu.Lock()
defer mu.Unlock()
c_width, c_height, c_rate := C.int(0), C.int(0), C.short(0)
C.XGetScreenConfiguration(&c_width, &c_height, &c_rate)
return types.ScreenSize{
Width: int(c_width),
Height: int(c_height),
Rate: int16(c_rate),
}
}View on GitHub (pinned to b0f01cedea)
Solutions
- Request a refresh rate listed in the XRandR mode list for the chosen resolution (xrandr -q)
- Omit/normalize the rate: pick the mode's default rate instead of a hardcoded value
- Cache and refresh supported rates via GetScreenSize/RRGetScreenInfo before applying
- Add a cvt/xrandr modeline for exotic rates if the hardware truly supports them
Example fix
// before
xorg.SetScreenSize(types.ScreenSize{Width: 1920, Height: 1080, Rate: 144})
// after
mode := pickMode(supportedModes, 1920, 1080) // rate from xrandr query
xorg.SetScreenSize(types.ScreenSize{Width: 1920, Height: 1080, Rate: mode.Rate}) Defensive patterns
Strategy: validation
Validate before calling
// validate the rate against modes reported by the X server
modes := queryXRandRModes(width, height)
func rateSupported(rate uint32, modes []Mode) bool {
for _, m := range modes {
if m.Rate == rate { return true }
}
return false
} Type guard
func isUnsupportedRate(err error) bool {
return err != nil && strings.Contains(err.Error(), "unsupported screen rate")
} Try / catch
s, err := xorg.SetScreenSize(want)
if isUnsupportedRate(err) {
// retry with the mode's default rate
want.Rate = defaultRateFor(want.Width, want.Height)
s, err = xorg.SetScreenSize(want)
} Prevention
- Read the allowed rates for the chosen resolution from XRandR before setting
- Never hardcode refresh rates; derive them from the queried modelist
- Handle fractional rates (59.94 vs 60) when matching modes
- On BadValue, retry with the default rate for the resolution
When it happens
Trigger: Calling ChangeScreenSize/SetScreenSize with a ScreenSize whose Rate is not offered by the X server for the given resolution (e.g. Rate 144 on a 60 Hz panel).
Common situations: Clients letting users pick arbitrary refresh rates; presets copied from another machine; HiDPI/TV modes supporting only 24/30/60 Hz; fractional rates (59.94) requested as integers.
Related errors
AI-assisted analysis of m1k1o/neko@b0f01cedea (2026-09-01).
Data as JSON: /api/errors/33f5a67309bc1321.
Report an issue: GitHub.