Skip to content

mc does not return error code to shell for incorrect get command when source is not s3 #5250

@scherepanov

Description

@scherepanov

Expected behavior

mc return non-zero exit code on error, when --json return error

Actual behavior

mc return zero exit code, while --json show error

Steps to reproduce the behavior

scherepanov@xxxxxxx:~/prod/bin$ mc update
You are already running the most recent version of ‘mc’.
scherepanov@xxxxxxx:~/prod/bin$ mc get sadfasdf/asdfdaf/dfsdf /tmp --json
{
 "status": "error",
 "error": {
  "message": "Unable to download.",
  "cause": {
   "message": "Source is not s3.",
   "error": {}
  },
  "type": "error"
 }
}
scherepanov@xxxxxx:~/prod/bin$ echo $?
0

mc --version

  • (paste output of mc --version)
    mc version RELEASE.2025-08-13T08-35-41Z (commit-id=7394ce0dd2a80935aded936b09fa12cbb3cb8096)
    Runtime: go1.24.6 linux/amd64
    Copyright (c) 2015-2025 MinIO, Inc.
    License GNU AGPLv3 https://www.gnu.org/licenses/agpl-3.0.html

System information

does not matter

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions