#1874·repomix

[BUG] A failed pack prints nothing at all under --quiet or -o -

Author: sxh313Created Sep 21, 2026Updated Sep 21, 2026
Labelsbugneeds discussion

Description

When a pack fails under --quiet (or in -o - / --stdout mode), Repomix exits 1 and prints nothing at all — not to stdout, not to stderr. The documented behaviour of --quiet is "Suppress all console output except errors" (README.md:616, and the same row in website/client/src/en/guide/command-line-options.md:16), and src/cli/cliRun.ts:262-264 states the intent outright:

typescript
/**
 * Validates flags that cannot be combined with --watch. Runs before log-level
 * changes so error messages are not suppressed by --quiet/--stdout.
 */

That hoisting is why --watch --copy --quiet is the one failure that still reports itself: every other error path runs after the level drops to SILENT, where nothing is printed. So a build script sees a bare exit 1 with no reason, and the inconsistency sits inside one function.

Steps to Reproduce

Verified with the published CLI (npx --yes [email protected]), Git Bash on Windows.

bash
mkdir -p fx/src && printf 'a\n' > fx/src/a.ts && printf 'x\n' > fx/README.md
printf '{"output":{"style":"bogus"}}\n' > bad.json
mkdir -p out

show() {
  label="$1"; shift
  npx --yes [email protected] "$@" > repomix.out 2> repomix.err
  code=$?
  printf '%-24s exit=%d  stdout=%sB  stderr=%sB  %s\n' "$label" "$code" \
    "$(wc -c < repomix.out | tr -d ' ')" "$(wc -c < repomix.err | tr -d ' ')" \
    "$(tr -d '\r' < repomix.err | grep -o '✖.*' | head -1)"
}

show "flag conflict"      fx -o out/w.xml --split-output 1kb --copy
show "conflict + --quiet" fx -o out/w.xml --split-output 1kb --copy --quiet
show "bad config"         fx -c bad.json -o out/b.xml
show "bad cfg + --quiet"  fx -c bad.json -o out/b.xml --quiet
show "missing dir +quiet" no-such-dir -o out/n.xml --quiet
show "bad cfg + -o -"     fx -c bad.json -o -

Actual

flag conflict            exit=1  stdout=1151B  stderr=96B  ✖ --split-output cannot be used with --copy. Split output generates multiple files.
conflict + --quiet       exit=1  stdout=0B  stderr=0B
bad config               exit=1  stdout=275B  stderr=185B  ✖ Invalid config schema
bad cfg + --quiet        exit=1  stdout=0B  stderr=0B
missing dir +quiet       exit=1  stdout=0B  stderr=0B
bad cfg + -o -           exit=1  stdout=0B  stderr=0B

Expected

The ✖ … line on stderr in every row — that is what "except errors" means, and it is what rows 1 and 3 already do without the flag.

Cause

--quiet and --stdout both set the level to SILENT (src/cli/cliRun.ts:348-349 and :357-358), and SILENT is below the gate on the only error printer (src/shared/logger.ts:34-38):

typescript
error(...args: unknown[]) {
  if (this.level >= repomixLogLevels.ERROR) {
    console.error(pc.red(this.formatArgs(args)));
  }
}

handleError() routes all three fatal messages through that printer (src/shared/errorHandle.ts:37, :49, :59), so at SILENT the terminal diagnostic is dropped along with the informational noise.

Fix direction

The fatal line has to bypass the level, and there is already a helper for exactly that shape — writeStderrLine() in src/shared/stderrWrite.ts, whose doc comment is "Writes a line to stderr, bypassing the logger … for flows whose output must never mix into --stdout packed output". Writing the three ✖ messages that way when the level is SILENT restores the documented contract, keeps stdout byte-clean in -o - mode, and leaves every other level untouched.

The one-line alternative — mapping --quiet to repomixLogLevels.ERROR, a level the logger already implements correctly (probed against the built module: at ERROR only error() emits, warn/info/success/note/log/debug/trace all stay silent) but that no CLI flag selects — does not cover -o -, which needs SILENT for its own reasons, and tests/cli/cliRun.test.ts:494-502 pins --quiet to SILENT.

Happy to send that as a PR if you agree with the direction.

System Info

  • CLI (repomix)
  • Repomix Version: 1.18.0 (published, via npx), also reproduced on main at 9f01703a built from source
  • Node.js Version: v24.18.0
  • Platform: Windows 11 (win32, x64)