{"record":{"id":"c936284da2ea6dfa","repo":"m1k1o/neko","slug":"unknown-screen-configuration-s","errorCode":null,"errorMessage":"unknown screen configuration %s","messagePattern":"unknown screen configuration (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/pkg/xorg/xorg.go","lineNumber":229,"sourceCode":"\n\t// convert variables to C types\n\tc_width, c_height, c_rate := C.int(s.Width), C.int(s.Height), C.short(s.Rate)\n\n\t// if screen configuration already exists, just set it\n\tstatus := C.XSetScreenConfiguration(c_width, c_height, c_rate)\n\tif status != C.RRSetConfigSuccess {\n\t\t// create new screen configuration\n\t\tC.XCreateScreenMode(c_width, c_height, c_rate)\n\n\t\t// screen configuration should exist now, set it\n\t\tstatus = C.XSetScreenConfiguration(c_width, c_height, c_rate)\n\t}\n\n\tvar err error\n\n\t// if screen configuration was not set successfully, return error\n\tif status != C.RRSetConfigSuccess {\n\t\terr = fmt.Errorf(\"unknown screen configuration %s\", s.String())\n\t}\n\n\t// if specified rate is not supported a BadValue error is returned\n\tif status == C.BadValue {\n\t\terr = fmt.Errorf(\"unsupported screen rate %d\", s.Rate)\n\t}\n\n\treturn s, err\n}\n\nfunc GetScreenSize() types.ScreenSize {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\n\tc_width, c_height, c_rate := C.int(0), C.int(0), C.short(0)\n\tC.XGetScreenConfiguration(&c_width, &c_height, &c_rate)\n\n\treturn types.ScreenSize{","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/m1k1o/neko/blob/b0f01cedea68893e85a3fd852c0521238c285695/server/pkg/xorg/xorg.go#L211-L247","documentation":"ChangeScreenSize applies an XRandR screen configuration (size and refresh rate) via XRRSetScreenConfig. If the X server returns a status other than RRSetConfigSuccess, the driver reports 'unknown screen configuration %s' where %s is the requested ScreenSize's string form. It means the requested resolution/rate combination was rejected by the X server.","triggerScenarios":"Requesting a ScreenSize whose width/height is not among the XRandR-supported modes for the output; calling SetScreenSize with values hardcoded from a different machine's display; X server lacking XRandR support on the active output.","commonSituations":"Remote-control clients offering resolutions the headless/virtual display does not support; VMs or dummy drivers with a limited modelist; stale cached screen-size list after the monitor or driver changed.","solutions":["Query GetScreenSize / XRandR-supported modes first and only request a listed size","Fall back to the current configuration when the request fails","Verify the X server has XRandR enabled (xrandr -q) and the output is active","Update the client's resolution list after display/driver changes"],"exampleFix":"// before\n_, err := xorg.SetScreenSize(types.ScreenSize{Width: 3840, Height: 2160, Rate: 60})\n// after\navail := xorg.GetScreenSizes() // only offer supported modes\nif containsSize(avail, want) {\n    _, err := xorg.SetScreenSize(want)\n} else {\n    err = fmt.Errorf(\"resolution %s not supported\", want)\n}","handlingStrategy":"validation","validationCode":"// only request sizes the server advertises as supported\nsizes := xorg.GetScreenSizes() // or cache from XRandR query\nfunc isSupported(s types.ScreenSize, sizes []types.ScreenSize) bool {\n    for _, v := range sizes {\n        if v.Width == s.Width && v.Height == s.Height && v.Rate == s.Rate {\n            return true\n        }\n    }\n    return false\n}","typeGuard":"func isScreenConfigRejected(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"unknown screen configuration\")\n}","tryCatchPattern":"s, err := xorg.SetScreenSize(want)\nif err != nil {\n    if isScreenConfigRejected(err) {\n        // fall back to current config or nearest supported mode\n        cur := xorg.GetScreenSize()\n        log.Printf(\"%v unsupported; keeping %s\", err, cur)\n        return cur, nil\n    }\n    return s, err\n}","preventionTips":["Enumerate XRandR modes (xrandr -q) and only offer those to users","Refresh the cached mode list after monitor/driver changes","Fall back to the current screen size on failure instead of retrying blindly","Verify XRandR is available on the target X server before exposing resolution switching"],"tags":["x11","xrandr","display","screen-resolution"],"backgroundTag":"unsupported-screen-mode","analyzedSha":"b0f01cedea68893e85a3fd852c0521238c285695","analyzedAt":"2026-09-01T10:35:56.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}