Skip to content

Windows service stuck in START_PENDING forever when Vector fails to start #25809

Description

@klondikedragon

A note for the community

I have a fix for this and will submit a PR.

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Problem

When Vector runs as a Windows service and startup fails (for example an invalid
configuration file), the service never reports any status to the Service
Control Manager and is left stuck in START_PENDING indefinitely:

  • sc query vector reports START_PENDING and never transitions; the
    vector.exe process remains running.
  • The service is NOT_STOPPABLE in this state, so sc stop cannot clear it;
    recovery required setting the service to disabled and terminating the
    process by hand.
  • No SCM error event (7000/7024/7031) is written to the System event log, so
    nothing indicates the service failed.
  • Configured recovery actions (sc failure / Services -> Recovery) never run,
    because the SCM never observes a failure.

Observed state with the stock v0.56.0 release binary and a config that fails
to load (unchanged after many minutes):

SERVICE_NAME: vector
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 2  START_PENDING
                                (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x7d0

Root cause: in run_service (src/vector_windows.rs), the failure arm of the
Application::prepare_start match returns Ok(()) without registering a
service control handler or calling set_service_status at all:

https://github.com/vectordotdev/vector/blob/v0.56.0/src/vector_windows.rs#L384-L440

(see the _ => Ok(()) arm at line 439; the Err(exit_code) from
prepare_start is discarded)

The success path correctly reports Running and later Stopped, so this only
affects startup failures. By contrast, running the same broken configuration
from a console correctly exits with code 78 (config error).

Expected behavior: on startup failure the service should register a control
handler and report SERVICE_STOPPED with a nonzero exit code
(e.g. ServiceExitCode::ServiceSpecific(exit_code)), so sc query reflects
the failure, the SCM logs event 7024, and service recovery can act on it.

Reproduction (elevated PowerShell):

  1. Register Vector as a service pointing at a config that fails to load
    (e.g. append broken: [ to a working vector.yaml).
  2. sc start vector
  3. sc query vector -> START_PENDING, forever (output above).

Configuration

(any broken config file when you start the windows service triggers this issue)

Version

vector 0.56.0 (x86_64-pc-windows-msvc 7923556 2026-05-02 05:50:46.918905925)

Debug Output

Not applicable: the failure is in Windows service status reporting, so there is
no console output in service context. Console mode with the same config exits
with code 78 after printing the config error.

Example Data

No response

Additional Context

Vector is registered as a Windows service (OWN_PROCESS) via the built-in service entry point from #2896.

Without a fix, an invalid vector config can leave the Windows service in a state where it can't be stopped or restarted without forcible intervention (terminating the process via task manager).

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions