Skip to content

The rm and rmi commands exits with status 0 even after an error #1731

@acinis

Description

@acinis

Describe the bug
The rm and rmi commands exits with status 0 even after an error.

Steps how to reproduce the behaviour

  1. Run toolbox list to check if the container we're trying to remove doesn't exist (eg. test).
  2. Try to remove it: toolbox rm test.
  3. An error message appears: Error: failed to inspect container test.
  4. Check the exit code echo $? and it will be 0.

Expected behaviour
The toolbox should exit with non-zero status code.

Actual behaviour
The toolbox exits with a status code 0.

Output of toolbox --version (v0.0.90+)
toolbox version 0.3

Toolbx package info (rpm -q toolbox)
toolbox-0.3-1.fc43.x86_64

Output of podman version

Client:        Podman Engine
Version:       5.7.0
API Version:   5.7.0
Go Version:    go1.25.4 X:nodwarf5
Git Commit:    0370128fc8dcae93533334324ef838db8f8da8cb
Built:         Tue Nov 11 01:00:00 2025
Build Origin:  Fedora Project
OS/Arch:       linux/amd64

Podman package info (rpm -q podman)
podman-5.7.0-1.fc43.x86_64

Info about your OS
Fedora Linux 43.20251129.0 (Silverblue) x86_64

Additional context
On the following lines there are fmt.Fprintf() calls, followed by continue, so the error is reported, but given action continues.
This is quite surprising when toolbox is used in scripts or chained commands such as toolbox rm X && toolbox create X.

toolbox/src/cmd/rmi.go

Lines 78 to 79 in e9ec7f1

fmt.Fprintf(os.Stderr, "Error: %s\n", err)
continue

toolbox/src/cmd/rmi.go

Lines 94 to 95 in e9ec7f1

fmt.Fprintf(os.Stderr, "Error: %s\n", err)
continue

toolbox/src/cmd/rmi.go

Lines 99 to 100 in e9ec7f1

fmt.Fprintf(os.Stderr, "Error: %s\n", err)
continue

toolbox/src/cmd/rm.go

Lines 78 to 79 in e9ec7f1

fmt.Fprintf(os.Stderr, "Error: %s\n", err)
continue

toolbox/src/cmd/rm.go

Lines 95 to 96 in e9ec7f1

fmt.Fprintf(os.Stderr, "Error: failed to inspect container %s\n", container)
continue

toolbox/src/cmd/rm.go

Lines 100 to 101 in e9ec7f1

fmt.Fprintf(os.Stderr, "Error: %s is not a Toolbx container\n", container)
continue

toolbox/src/cmd/rm.go

Lines 105 to 106 in e9ec7f1

fmt.Fprintf(os.Stderr, "Error: %s\n", err)
continue

Metadata

Metadata

Assignees

No one assigned

    Labels

    1. BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions