LizardByte / LizardByte/Sunshine

`Error: Couldn't find monitor [0]` On Autodetect/KMS when monitor turns off from inactivity

Open
#5,209 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
41.3k
Forks
2.1k
Avg merge
23h 47m
Merged PRs (30d)
124

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your issue described in the documentation?

- [x] I have read the documentation

### Is your issue present in the latest beta/pre-release?

None

### Describe the Bug

Using KDE Plasmas (Wayland), when the feature to turn off the display after some inactivity is triggered and the monitor turns off, Autodetect tries to use KMS, fails, and throws an error 503 on Moonlight.

### Expected Behavior

While KMS failing on "headless" is known (https://github.com/LizardByte/Sunshine/issues/2250), I expected Autodetect to failover to Kwin Screenshare or XDG Portal after KMS failed. I did not expect to need to specify those in the advanced settings to work around the issue.

XDG Portal and Kwin Screenshare function properly and stream even when the monitor has turned off.

### Additional Context

This seems similar to https://github.com/LizardByte/Sunshine/issues/2250 but it looks a bit different. Furthermore, that's on GNOME, not KDE Plasma.
```
kinfo:
Operating System: EndeavourOS
KDE Plasma Version: 6.6.5
KDE Frameworks Version: 6.26.0
Qt Version: 6.11.1
Kernel Version: 6.18.33-1-lts (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 3600 6-Core Processor
Memory: 16 GiB of RAM (15.5 GiB usable)
Graphics Processor: NVIDIA GeForce GTX 1050
```

### Host Operating System

Linux

### Operating System Version

EndeavourOS

### Architecture

amd64/x86_64

### Package

Linux - LizardByte/pacman-repo

### GPU Type

NVIDIA

### GPU Model

GTX 1050

### GPU Driver/Mesa Version

580.159.04

### Capture Method

KMS (Linux)

### Apps

```json

```

### Log output

```shell
[2026-05-28 16:41:22.433]: Info: Sunshine version: 2026.528.35537 commit: 22d9aa3b2e5fe0cee654e830b5715901b37cf0bd
[2026-05-28 16:41:22.433]: Info: Package Publisher: LizardByte
[2026-05-28 16:41:22.433]: Info: Publisher Website: https://app.lizardbyte.dev
[2026-05-28 16:41:22.433]: Info: Get support: https://app.lizardbyte.dev/support
[2026-05-28 16:41:22.433]: Info: config: 'encoder' = nvenc
[2026-05-28 16:41:22.433]: Info: config: 'nvenc_preset' = 3
[2026-05-28 16:41:22.433]: Info: config: 'vk_tune' = 1
[2026-05-28 16:41:22.433]: Info: config: 'origin_web_ui_allowed' = pc
[2026-05-28 16:41:22.433]: Info: config: 'sw_preset' = ultrafast
[2026-05-28 16:41:22.433]: Info: config: 'vk_rc_mode' = 4
[2026-05-28 16:41:22.449]: Error: Failed to create session:
[2026-05-28 16:41:22.449]: Info: [wayland] Found display [wayland-0]
[2026-05-28 16:41:22.449]: Info: [wayland] Found interface: zxdg_output_manager_v1(31) version 3
[2026-05-28 16:41:22.449]: Info: [wayland] Found interface: zwp_linux_dmabuf_v1(57) version 5
[2026-05-28 16:41:22.449]: Info: [wayland] Found interface: wl_output(64) version 4
[2026-05-28 16:41:22.449]: Warning: [wlgrab] Missing Wayland wire for wlr-export-dmabuf
[2026-05-28 16:41:22.449]: Info: /dev/dri/card0 -> nvidia-drm
[2026-05-28 16:41:22.449]: Info: [wayland] Found display [wayland-0]
[2026-05-28 16:41:22.449]: Info: [wayland] Found display [wayland-0]
[2026-05-28 16:41:22.449]: Info: [wayland] Found interface: zxdg_output_manager_v1(31) version 3
[2026-05-28 16:41:22.449]: Info: [wayland] Found interface: zwp_linux_dmabuf_v1(57) version 5
[2026-05-28 16:41:22.449]: Info: [wayland] Found interface: wl_output(64) version 4
[2026-05-28 16:41:22.449]: Info: [wayland] Resolution: 1920x1080
[2026-05-28 16:41:22.449]: Info: [wayland] Offset: 0x0
[2026-05-28 16:41:22.449]: Info: [wayland] Logical size: 1920x1080
[2026-05-28 16:41:22.449]: Info: [wayland] Name: HDMI-A-1
[2026-05-28 16:41:22.449]: Info: [wayland] Found monitor: MOV HDMI-A-1-R238
[2026-05-28 16:41:22.449]: Info: -------- Start of KMS monitor list --------
[2026-05-28 16:41:22.449]: Info: Monitor 0 is HDMI-A-1: MOV HDMI-A-1-R238
[2026-05-28 16:41:22.450]: Info: --------- End of KMS monitor list ---------
[2026-05-28 16:41:22.450]: Info: [portalgrab] Loaded portal restore token from disk
[2026-05-28 16:41:22.793]: Info: Trying encoder [nvenc]
[2026-05-28 16:41:22.793]: Info: Screencasting with KMS
[2026-05-28 16:41:22.793]: Info: /dev/dri/card0 -> nvidia-drm
[2026-05-28 16:41:22.793]: Info: Found monitor for DRM screencasting
[2026-05-28 16:41:22.793]: Info: Found connector ID [94]
[2026-05-28 16:41:22.793]: Info: Found cursor plane [54]
[2026-05-28 16:41:22.793]: Info: Creating encoder [h264_nvenc]
[2026-05-28 16:41:22.793]: Info: Color coding: SDR (Rec. 601)
[2026-05-28 16:41:22.793]: Info: Color depth: 8-bit
[2026-05-28 16:41:22.793]: Info: Color range: JPEG
[2026-05-28 16:41:22.804]: Info: EGL: context priority set to HIGH
[2026-05-28 16:41:22.873]: Info: Streaming bitrate is 1000000
[2026-05-28 16:41:22.877]: Warning: [h264_nvenc @ 0x55fc04e75b00] Multiple reference frames are not supported by the device
[2026-05-28 16:41:22.877]: Error: [h264_nvenc @ 0x55fc04e75b00] Provided device doesn't support required NVENC features
[2026-05-28 16:41:23.148]: Error: Could not open codec [h264_nvenc]: Function not implemented
[2026-05-28 16:41:23.149]: Info: Creating encoder [h264_nvenc]
[2026-05-28 16:41:23.149]: Info: Color coding: SDR (Rec. 601)
[2026-05-28 16:41:23.149]: Info: Color depth: 8-bit
[2026-05-28 16:41:23.149]: Info: Color range: JPEG
[2026-05-28 16:41:23.149]: Info: EGL: context priority set to HIGH
[2026-05-28 16:41:23.205]: Info: Streaming bitrate is 1000000
[2026-05-28 16:41:23.462]: Info: Creating encoder [hevc_nvenc]
[2026-05-28 16:41:23.462]: Info: Color coding: SDR (Rec. 601)
[2026-05-28 16:41:23.462]: Info: Color depth: 8-bit
[2026-05-28 16:41:23.462]: Info: Color range: JPEG
[2026-05-28 16:41:23.463]: Info: EGL: context priority set to HIGH
[2026-05-28 16:41:23.465]: Info: Streaming bitrate is 1000000
[2026-05-28 16:41:23.467]: Warning: [hevc_nvenc @ 0x55fc04e75b00] Multiple reference frames are not supported by the device
[2026-05-28 16:41:23.467]: Error: [hevc_nvenc @ 0x55fc04e75b00] Provided device doesn't support required NVENC features
[2026-05-28 16:41:23.717]: Error: Could not open codec [hevc_nvenc]: Function not implemented
[2026-05-28 16:41:23.718]: Info: Creating encoder [hevc_nvenc]
[2026-05-28 16:41:23.718]: Info: Color coding: SDR (Rec. 601)
[2026-05-28 16:41:23.718]: Info: Color depth: 8-bit
[2026-05-28 16:41:23.718]: Info: Color range: JPEG
[2026-05-28 16:41:23.719]: Info: EGL: context priority set to HIGH
[2026-05-28 16:41:23.720]: Info: Streaming bitrate is 1000000
[2026-05-28 16:41:23.976]: Info: Creating encoder [av1_nvenc]
[2026-05-28 16:41:23.976]: Info: Color coding: SDR (Rec. 601)
[2026-05-28 16:41:23.976]: Info: Color depth: 8-bit
[2026-05-28 16:41:23.976]: Info: Color range: JPEG
[2026-05-28 16:41:23.977]: Info: EGL: context priority set to HIGH
[2026-05-28 16:41:23.979]: Info: Streaming bitrate is 1000000
[2026-05-28 16:41:23.981]: Warning: [av1_nvenc @ 0x55fc04e75b00] Codec not supported
[2026-05-28 16:41:23.981]: Error: [av1_nvenc @ 0x55fc04e75b00] Provided device doesn't support required NVENC features
[2026-05-28 16:41:24.231]: Error: Could not open codec [av1_nvenc]: Function not implemented
[2026-05-28 16:41:24.232]: Info: Creating encoder [av1_nvenc]
[2026-05-28 16:41:24.232]: Info: Color coding: SDR (Rec. 601)
[2026-05-28 16:41:24.232]: Info: Color depth: 8-bit
[2026-05-28 16:41:24.232]: Info: Color range: JPEG
[2026-05-28 16:41:24.232]: Info: EGL: context priority set to HIGH
[2026-05-28 16:41:24.234]: Info: Streaming bitrate is 1000000
[2026-05-28 16:41:24.236]: Warning: [av1_nvenc @ 0x55fc04e75b00] Codec not supported
[2026-05-28 16:41:24.236]: Error: [av1_nvenc @ 0x55fc04e75b00] Provided device doesn't support required NVENC features
[2026-05-28 16:41:24.486]: Error: Could not open codec [av1_nvenc]: Function not implemented
[2026-05-28 16:41:24.487]: Info: Screencasting with KMS
[2026-05-28 16:41:24.487]: Info: /dev/dri/card0 -> nvidia-drm
[2026-05-28 16:41:24.487]: Info: Found monitor for DRM screencasting
[2026-05-28 16:41:24.487]: Info: Found connector ID [94]
[2026-05-28 16:41:24.487]: Info: Found cursor plane [54]
[2026-05-28 16:41:24.487]: Info: Creating encoder [hevc_nvenc]
[2026-05-28 16:41:24.487]: Info: Color coding: SDR (Rec. 709)
[2026-05-28 16:41:24.487]: Info: Color depth: 10-bit
[2026-05-28 16:41:24.487]: Info: Color range: JPEG
[2026-05-28 16:41:24.488]: Info: EGL: context priority set to HIGH
[2026-05-28 16:41:24.490]: Info: Streaming bitrate is 1000000
[2026-05-28 16:41:24.746]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2026-05-28 16:41:24.746]: Info:
[2026-05-28 16:41:24.746]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2026-05-28 16:41:24.746]: Info:
[2026-05-28 16:41:24.746]: Info: Found H.264 encoder: h264_nvenc [nvenc]
[2026-05-28 16:41:24.746]: Info: Found HEVC encoder: hevc_nvenc [nvenc]
[2026-05-28 16:41:24.747]: Info: Starting system tray
[2026-05-28 16:41:24.748]: Info: Adding avahi service tom
[2026-05-28 16:41:24.749]: Info: Avahi service tom successfully established.
[2026-05-28 16:41:24.749]: Info: Configuration UI available at [https://localhost:47990]
[2026-05-28 16:41:24.792]: Info: System tray created
[2026-05-28 16:41:24.792]: Info: Starting main loop
[2026-05-28 16:42:10.354]: Info: Trying encoder [nvenc]
[2026-05-28 16:42:10.354]: Info: Screencasting with KMS
[2026-05-28 16:42:10.354]: Info: /dev/dri/card0 -> nvidia-drm
[2026-05-28 16:42:10.355]: Error: Couldn't find monitor [0]
[2026-05-28 16:42:10.355]: Info: /dev/dri/card0 -> nvidia-drm
[2026-05-28 16:42:10.355]: Error: Couldn't find monitor [0]
[2026-05-28 16:42:10.555]: Info: Screencasting with KMS
[2026-05-28 16:42:10.555]: Info: /dev/dri/card0 -> nvidia-drm
[2026-05-28 16:42:10.555]: Error: Couldn't find monitor [0]
[2026-05-28 16:42:10.555]: Info: /dev/dri/card0 -> nvidia-drm
[2026-05-28 16:42:10.555]: Error: Couldn't find monitor [0]
[2026-05-28 16:42:10.755]: Info: Encoder [nvenc] failed
[2026-05-28 16:42:10.755]: Error: Couldn't find any working encoder matching [nvenc]
[2026-05-28 16:42:10.755]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2026-05-28 16:42:10.755]: Info: Trying encoder [vulkan]
[2026-05-28 16:42:10.755]: Info: Screencasting with KMS
[2026-05-28 16:42:10.755]: Info: /dev/dri/card0 -> nvidia-drm
[2026-05-28 16:42:10.755]: Error: Couldn't find monitor [0]
[2026-05-28 16:42:10.755]: Info: /dev/dri/card0 -> nvidia-drm
[2026-05-28 16:42:10.756]: Error: Couldn't find monitor [0]
[2026-05-28 16:42:10.956]: Info: Screencasting with KMS
[2026-05-28 16:42:10.956]: Info: /dev/dri/card0 -> nvidia-drm
[2026-05-28 16:42:10.956]: Error: Couldn't find monitor [0]
[2026-05-28 16:42:10.956]: Info: /dev/dri/card0 -> nvidia-drm
[2026-05-28 16:42:10.956]: Error: Couldn't find monitor [0]
[2026-05-28 16:42:11.156]: Info: Encoder [vulkan] failed
[2026-05-28 16:42:11.156]: Info: Trying encoder [vaapi]
[2026-05-28 16:42:11.156]: Info: Screencasting with KMS
[2026-05-28 16:42:11.156]: Info: /dev/dri/card0 -> nvidia-drm
[2026-05-28 16:42:11.156]: Error: Couldn't find monitor [0]
[2026-05-28 16:42:11.156]: Info: /dev/dri/card0 -> nvidia-drm
[2026-05-28 16:42:11.156]: Error: Couldn't find monitor [0]
[2026-05-28 16:42:11.356]: Info: Screencasting with KMS
[2026-05-28 16:42:11.356]: Info: /dev/dri/card0 -> nvidia-drm
[2026-05-28 16:42:11.357]: Error: Couldn't find monitor [0]
[2026-05-28 16:42:11.357]: Info: /dev/dri/card0 -> nvidia-drm
[2026-05-28 16:42:11.357]: Error: Couldn't find monitor [0]
[2026-05-28 16:42:11.557]: Info: Encoder [vaapi] failed
[2026-05-28 16:42:11.557]: Info: Trying encoder [software]
[2026-05-28 16:42:11.557]: Info: Screencasting with KMS
[2026-05-28 16:42:11.557]: Info: /dev/dri/card0 -> nvidia-drm
[2026-05-28 16:42:11.557]: Error: Couldn't find monitor [0]
[2026-05-28 16:42:11.757]: Info: Screencasting with KMS
[2026-05-28 16:42:11.757]: Info: /dev/dri/card0 -> nvidia-drm
[2026-05-28 16:42:11.757]: Error: Couldn't find monitor [0]
[2026-05-28 16:42:11.957]: Info: Encoder [software] failed
[2026-05-28 16:42:11.957]: Fatal: Unable to find display or encoder during startup.
[2026-05-28 16:42:11.957]: Fatal: Please check that a display is connected and powered on.
```

### Online logs

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Autodetect capture path around KMS and its fallback handling after the monitor disappears. Compare the KMS failure with the mentioned Kwin Screenshare and XDG Portal paths. Done means Autodetect fails over to a working capture method when the display is off, instead of returning “Couldn't find monitor [0]”.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
desktop-dev, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.