tirth8205/code-review-graph · error · SystemExit

raise SystemExit(1)

Error message

raise SystemExit(1)

What it means

During uninstall/unbind, the CLI computes a preview of planned actions. If nothing needs removing but the preview collected errors, the CLI treats this as a failed state and exits with code 1 instead of a clean no-op. This distinguishes 'nothing installed' (success, informational message) from 'could not determine what is installed' (failure).

Source

Thrown at code_review_graph/cli.py:1538

        def _print_report(report: UninstallReport) -> None:
            for action in report.removed_paths:
                print(f"  delete  {action}")
            for action in report.edited_paths:
                print(f"  edit    {action}")
            for action in report.skipped_paths:
                print(f"  skip    {action}")
            for error in report.errors:
                print(f"  error   {error}")

        preview = run_uninstall(**options, dry_run=True)
        if scoped_platforms:
            print(f"code-review-graph unbind ({platform_target}) — planned actions:")
        else:
            print("code-review-graph uninstall — planned actions:")
        _print_report(preview)
        if preview.total_actions == 0:
            if preview.errors:
                raise SystemExit(1)
            if scoped_platforms:
                print(
                    f"  (nothing to do — {platform_target} has no "
                    "code-review-graph MCP registration)"
                )
            else:
                print("  (nothing to do — no code-review-graph artifacts found)")
            return
        if args.dry_run:
            print("\n[dry-run] No changes made.")
            if preview.errors:
                raise SystemExit(1)
            return
        action_word = "unbind" if scoped_platforms else "uninstall"
        if not args.yes and not _confirm_yes_no(
            f"\nProceed with {action_word}?", default_yes=False
        ):
            print("Aborted.")

View on GitHub (pinned to b58668751a)

Solutions

  1. Re-run with elevated permissions or fix ownership/permissions on the paths named in the preview errors
  2. Inspect the printed report (_print_report output) to see which files failed to scan and repair or delete them manually
  3. Re-run uninstall afterwards to confirm a clean exit

Example fix

# before
$ code-review-graph uninstall
(uninstall — planned actions: 0, errors present)
$ echo $?
1

# after
# fix the unreadable config reported in the preview, then:
$ code-review-graph uninstall
$ echo $?
0
Defensive patterns

Strategy: try-catch

Validate before calling

import subprocess, sys
rc = subprocess.run([sys.executable, "-m", "code_review_graph", "uninstall", "--dry-run"]).returncode
if rc != 0:
    # preview may have errors; inspect config files before proceeding
    ...

Try / catch

In shell/Python scripts invoking the CLI, capture the exit code and treat 1 after a zero-action preview as 'inspect errors', printing the report for the offending paths instead of aborting the whole pipeline.

Prevention

When it happens

Trigger: Running `code-review-graph uninstall` (or a platform-scoped unbind) in an environment where scanning registrations produced errors — e.g. unreadable config files, permission problems on MCP registration locations — with zero actionable results.

Common situations: Partial or corrupted MCP client configurations, files locked by another process, permission-restricted home directory entries, or half-completed prior uninstalls leaving malformed config.

Related errors


AI-assisted analysis of tirth8205/code-review-graph@b58668751a (2026-08-28). Data as JSON: /api/errors/74ae8a2ed1224dcf. Report an issue: GitHub.