Skip to content

Can't connect after computer reboot if there's global_prep_cmd set #6024

Closed

Description

@bgr

Is there an existing issue for this?

  • I have searched the existing issues

Is your issue described in the documentation?

  • I have read the documentation

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

This issue is present in the latest pre-release

Describe the Bug

When the computer is at the login screen after a reboot (so nobody had logged in yet), starting "Desktop" via Moonlight fails with "Failed to start the specified application (Error 0)" (it's probably -1 but Moonlight displays it wrongly). This used to work fine before, I only notice it now after updating to own build made from d0b4a88 (#5782).
When I clear the global_prep_cmd in sunshine.conf then I'm able to connect. This worked before by ignoring the failed execution of prep command.

Expected Behavior

Moonlight connects to the computer that rebooted and is at login screen, and has global_prep_cmd populated in sunshine.conf

Additional Context

Seems to have been broken in #4390

Before it, child.wait() didn't take an error argument and the exit code check skipped permission_denied, so the leftover permission error from the prep command that never started was ignored and the launch continued.

Host Operating System

Windows

Operating System Version

10 22H2 19045.7807

Architecture

amd64/x86_64

Package

other (self built)

GPU Type

NVIDIA

GPU Model

1050 ti

GPU Driver/Mesa Version

582.78

Capture Method

None

Apps

Log output

Debug: QueryUserToken failed, this would prevent commands from launching under the users profile.
Error: Couldn't run [c:\scripts\ss_start.bat]: System: Permission denied
Error: [c:\scripts\ss_start.bat] wait failed with error code [generic:13]

Online logs

No response

Activity

  1. ReenigneArcher commented on Oct 31, 2026

    @ReenigneArcher
    Member

    Can you actually replicate this in our latest stable or beta?

  2. bgr commented on Oct 31, 2026

    @bgr
    Author

    Yes.

    [2026-10-30 12:56:03.859]: Info: Sunshine version: 2026.914.233613 commit: 63d35f702ee9e362e43263742981836ec0710384
    [2026-10-30 12:56:03.860]: Info: Package Publisher: LizardByte
    [2026-10-30 12:56:03.860]: Info: config: 'global_prep_cmd' = [{"do":"c:\\scripts\\ss_start.bat","undo":"c:\\scripts\\ss_end.bat","elevated":false}]
    ...
    [2026-10-31 15:05:43.288]: Info: Executing Do Cmd: [c:\scripts\ss_start.bat]
    [2026-10-31 15:05:43.288]: Debug: QueryUserToken failed, this would prevent commands from launching under the users profile.
    [2026-10-31 15:05:43.288]: Error: Couldn't run [c:\scripts\ss_start.bat]: System: Permission denied
    [2026-10-31 15:05:43.288]: Error: [c:\scripts\ss_start.bat] wait failed with error code [generic:13]
    ...
    [2026-10-31 15:06:07.898]: Debug: DESTINATION :: /launch
    ...
    [2026-10-31 15:06:07.900]: Info: Executing Do Cmd: [c:\scripts\ss_start.bat]
    [2026-10-31 15:06:07.900]: Debug: QueryUserToken failed, this would prevent commands from launching under the users profile.
    [2026-10-31 15:06:07.900]: Error: Couldn't run [c:\scripts\ss_start.bat]: System: Permission denied
    [2026-10-31 15:06:07.900]: Error: [c:\scripts\ss_start.bat] wait failed with error code [generic:13]
    
  3. ReenigneArcher commented on Nov 2, 2026

    @ReenigneArcher
    Member

    Can you test if the issue is resolved with #6030 ?

  4. bgr commented on Nov 2, 2026

    @bgr
    Author

    Tested, works fine now. I cherry-picked the fix onto my branch and made sure that no users are signed in, it connected:

    [2026-11-02 12:43:36.033]: Info: Sunshine version: 0.0.0-99fc548b commit:
    ...
    [2026-11-02 12:44:13.632]: Debug: DESTINATION :: /launch
    ...
    [2026-11-02 12:44:16.629]: Info: Executing Do Cmd: [c:\scripts\ss_start.bat]
    [2026-11-02 12:44:16.629]: Debug: QueryUserToken failed, this would prevent commands from launching under the users profile.
    [2026-11-02 12:44:16.629]: Error: Couldn't run [c:\scripts\ss_start.bat]: System: Permission denied
    [2026-11-02 12:44:16.629]: Info: Executing [Desktop]
    ...
    [2026-11-02 12:44:16.744]: Info: New streaming session started [active sessions: 1]
    ...
    [2026-11-02 12:44:17.167]: Info: CLIENT CONNECTED
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions