Skip to content

wslc container rm --force fails when the container does not exist #42009

Closed

Description

@polys

Windows Version

Microsoft Windows [Version 10.0.26200.9711]

WSL Version

3.0.3.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

6.18.54.1-1

Distro Version

N/A (wslc container command)

Other Software

  • Docker 29.9.1, build dfc520d (comparison only)

Repro Steps

  1. Run wslc container rm does-not-exist --force --volumes, where no container
    named does-not-exist exists.
  2. Check the exit code.

Expected Behavior

--force should make a missing container a no-op, as in Docker:

> docker rm does-not-exist --force --volumes
> echo $LASTEXITCODE
0

Docker prints nothing and exits 0. That lets scripts run an idempotent
cleanup such as rm --force before run, with no existence check.

Actual Behavior

> wslc container rm does-not-exist --force --volumes
Container 'does-not-exist' not found.
Error code: WSLC_E_CONTAINER_NOT_FOUND
If this error was unexpected, please consider searching for existing issues or filing a new issue at https://github.com/microsoft/WSL/issues.
> echo $LASTEXITCODE
1

The same happens without --volumes.

wslc container rm --help describes --force as "Delete containers even if
they are running". It says nothing about missing containers.

Diagnostic Logs

N/A

Activity

  1. github-actions commented on Oct 21, 2026

    @github-actions
    Contributor

    Logs are required for review from WSL team

    If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
    Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

    How to collect WSL logs

    Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

    Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
    Set-ExecutionPolicy Bypass -Scope Process -Force
    .\collect-wsl-logs.ps1
    

    The script will output the path of the log file once done.

    If this is a networking issue, please use .\collect-wsl-logs.ps1 -LogProfile networking instead, following the instructions in Collect WSL logs for networking issues

    Once completed please upload the output files to this GitHub issue.

    See Collect WSL logs (recommended method).

    If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.

  2. polys commented on Oct 21, 2026

    @polys
    Author

    /feature

  3. github-actions commented on Oct 21, 2026

    @github-actions
    Contributor
    Diagnostic information
    Found '/feature', adding tag 'feature'
    
  4. self-assigned this
    on Oct 21, 2026
  5. ggarzia-MSFT commented on Oct 21, 2026

    @ggarzia-MSFT
    Contributor

    Thanks for reporting this bug, I was able to repro

  6. polys commented on Oct 22, 2026

    @polys
    Author

    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions