> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kosli.com/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.kosli.com/feedback

```json
{
  "path": "/troubleshooting/subshell_stderr",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# CLI in subshell captures stderr

> How to handle Kosli CLI debug output being captured in subshell variables in CI workflows.

## Error

When capturing Kosli CLI output in a subshell variable in CI, the variable contains debug output mixed with the expected value:

```shell theme={"theme":"dracula","languages":{"custom":["/languages/rego.json"]}}
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:

```shell theme={"theme":"dracula","languages":{"custom":["/languages/rego.json"]}}
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.
