{"record":{"id":"a4a2ba7a6f8e176d","repo":"zed-industries/zed","slug":"could-not-get-screen-resolution","errorCode":null,"errorMessage":"Could not get screen resolution","messagePattern":"Could not get screen resolution","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"script/zed-local","lineNumber":113,"sourceCode":"    (display) => display?.spdisplays_ndrvs,\n  )\n    ?.find((entry) => entry?.spdisplays_main === \"spdisplays_yes\")\n    ?._spdisplays_resolution?.match(RESOLUTION_REGEX);\n  if (!mainDisplayResolution) {\n    throw new Error(\"Could not parse screen resolution\");\n  }\n  screenWidth = parseInt(mainDisplayResolution[1]);\n  screenHeight = parseInt(mainDisplayResolution[2]) - titleBarHeight;\n} else if (platform === \"linux\") {\n  // Linux\n  try {\n    const xrandrOutput = execSync('xrandr | grep \"\\\\*\" | cut -d\" \" -f4', {\n      encoding: \"utf8\",\n    }).trim();\n    [screenWidth, screenHeight] = xrandrOutput.split(\"x\").map(Number);\n  } catch (err) {\n    console.log(err);\n    throw new Error(\"Could not get screen resolution\");\n  }\n} else if (platform === \"win32\") {\n  // windows\n  try {\n    const resolutionOutput = execSync(\n      `powershell -Command \"& {Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Screen]::PrimaryScreen.WorkingArea.Size}\"`,\n      { encoding: \"utf8\" },\n    ).trim();\n    [screenWidth, screenHeight] = resolutionOutput.match(/\\d+/g).map(Number);\n  } catch (err) {\n    console.log(err);\n    throw new Error(\"Could not get screen resolution on Windows\");\n  }\n}\n\nif (platform !== \"win32\") {\n  screenHeight -= titleBarHeight;\n}","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/script/zed-local#L95-L131","documentation":"On Linux, script/zed-local shells out to `xrandr | grep \"*\" | cut -d\" \" -f4` to read the active mode; any failure in that pipeline (xrandr missing, no '*' mode line, grep exiting 1) lands in the catch block and is rethrown as this error.","triggerScenarios":"xrandr not installed (x11-xserver-utils missing); running under bare Wayland with no Xwayland; an Xvfb session with no screen mode configured; output formatting where column 4 isn't the geometry.","commonSituations":"Minimal containers or devimages without X utilities; headless test boxes; distros whose xrandr column layout differs.","solutions":["Install xrandr (Debian/Ubuntu: `sudo apt install x11-xserver-utils`)","Run `xrandr` manually and confirm a '*' line exists whose 4th field is WxH","Under Xvfb, pass an explicit geometry: `xvfb-run -s \"-screen 0 1920x1080x24\"`","On Wayland-only sessions, run via Xwayland or patch in an explicit size"],"exampleFix":"# before\nxvfb-run node script/zed-local   # xrandr shows no '*' mode\n\n# after\nxvfb-run -s \"-screen 0 1920x1080x24\" node script/zed-local","handlingStrategy":"fallback","validationCode":"const probe = execSync(\"xrandr --current\", { encoding: \"utf8\" });\nif (!/^\\s*\\d+x\\d+.*\\*/m.test(probe)) {\n  console.error(\"no active xrandr mode — configure the screen or install x11-xserver-utils\");\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":"try {\n  [screenWidth, screenHeight] = xrandrOutput.split(\"x\").map(Number);\n} catch {\n  console.warn(\"xrandr failed; defaulting to 1920x1080\");\n  [screenWidth, screenHeight] = [1920, 1080];\n}","preventionTips":["Verify `xrandr --current | grep '*'` works on a new Linux box before running zed-local","Use xvfb-run with an explicit -screen geometry","Install x11-xserver-utils in devcontainer images"],"tags":["linux","xrandr","display","x11","script"],"backgroundTag":null,"analyzedSha":"bc538def4545534201bbfcac4e95ac34ea6501b6","analyzedAt":"2026-08-16T07:30:46.435Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}