Skip to content

backupRun reports failed backups as success; backupStatus/List hide restic errors #87

Closed

Description

@TMHSDigital

Summary

homelab_backupRun reports a failed backup as a successful result with the message "Backup script not found". homelab_backupStatus and homelab_backupList turn every restic error into "No backup repo found". On a backup tool, that hides real failures.

Where

  • mcp-server/src/tools/backupRun.ts:24
  • mcp-server/src/tools/backupStatus.ts:26
  • mcp-server/src/tools/backupList.ts:27

Details

"sudo /opt/backup/backup.sh 2>&1 || echo 'Backup script not found at /opt/backup/backup.sh'"

Any non-zero exit from the script triggers the echo, which exits 0. execSSH therefore resolves, and the tool returns without isError. Examples of such exits: a restic error, a locked repo, a full disk, a wrong password, or sudo needing a tty.

The status and list tools use restic ... 2>/dev/null || echo "No backup repo found ...". That throws away stderr and reports every failure as "repo missing".

Impact

Real backup failures look like success, and the message points at the wrong cause. Users and agents may conclude backups are fine or simply unconfigured.

Steps to reproduce

  1. Make the restic repo unreachable, for example by unmounting the backup target.
  2. Call homelab_backupRun {confirm: true}.
  3. The response ends with "Backup script not found..." and isError is not set.

Suggested fix

  • Check for the script separately: test -x /opt/backup/backup.sh || { echo 'Backup script not found'; exit 127; }.
  • Then run the script without ||, so a non-zero exit becomes a CommandFailedError that carries stderr.
  • In status and list, drop 2>/dev/null ||. If a friendly message is still wanted, match restic's "repository does not exist" error specifically.

Acceptance criteria

  • A failing backup script returns isError: true with stderr
  • A missing script gives a distinct "not found" message
  • Locked repo and wrong-password errors surface as errors in status and list
  • Mocked-SSH tests cover each case

Getting started

  • Relevant files: the three tool files above
  • How to run tests: cd mcp-server && npm test

Filed by repo-audit/full-audit at 9cfe5e3. Severity: high. Effort: S. audit-key: bug|mcp-server/src/tools/backupRun.ts|register

Activity

  1. added
    bug
    good first issue
    severity: high
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issueseverity: high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions