Skip to main content

Error

When capturing Kosli CLI output in a subshell variable in CI, the variable contains debug output mixed with the expected value:
DIGEST="$(kosli fingerprint "${IMAGE_NAME}" --artifact-type=docker)"

echo "DIGEST=${DIGEST}"
DIGEST=[debug] calculated fingerprint: 2c6079df5829...
2c6079df58292ed10e8074adcb74be549b7f841a1bd8266f06bb5c518643193e

Solution

Explicitly set --debug=false when running Kosli CLI commands in a subshell:
DIGEST="$(kosli fingerprint "${IMAGE_NAME}" --artifact-type=docker --debug=false)"

Context

The Kosli CLI writes debug information to stderr and all other output to stdout. In a local terminal, a $(subshell) captures only stdout. However, in many CI workflows (including GitHub and GitLab), stdout and stderr are multiplexed together, causing debug output to leak into captured variables.

See also

  • Output and verbosity — full reference for the CLI’s stdout/stderr behavior, [warning] messages, and the --quiet and --debug flags.
Last modified on June 8, 2026