Skip to content

diagnostics/healthCheck report success for unknown or unreachable nodes #92

Closed

Description

@TMHSDigital

Summary

The self-test and diagnostics tools report success when the node is unknown, unreachable, or rejects auth, and malformed HOMELAB_NODES JSON is silently ignored. The real cause is never shown.

Where

  • mcp-server/src/tools/diagnostics.ts:12-17
  • mcp-server/src/tools/healthCheck.ts:18-23
  • mcp-server/src/tools/certList.ts:27-29,52-53
  • mcp-server/src/tools/nodeList.ts:19-20
  • mcp-server/src/utils/ssh-api.ts:46-65 (getNodesRegistry: catch { return {} })

Details

  • Each sub-check catches every error, replaces it with "(unavailable)", "not available", or "Failed to query", and never sets isError. Errors swallowed this way include SSHError for an unknown node, SSHAuthError, and SSHConnectionError.
  • getNodesRegistry swallows JSON parse errors.
  • Entries without host become host: "".

Impact

  • A mistyped node name, bad credentials, or broken HOMELAB_NODES produces "0/7 checks passed" or nine "(unavailable)" sections with no explanation, which defeats the purpose of a diagnostics tool.
  • With an unreachable host, each sub-check waits for the connect timeout in turn.

Steps to reproduce

  1. Call homelab_diagnostics {node: "typo"} or homelab_healthCheck {node: "typo"}.
  2. Set HOMELAB_NODES to invalid JSON and call any tool with node: "nas". The result is "Unknown node" with no parse hint.

Suggested fix

  • Run one initial connectivity probe without catching, and return errorResponse if it fails.
  • Include the error message in each failed check's detail.
  • Parse HOMELAB_NODES once with a zod schema, log parse errors to stderr, require host, and mention the parse failure in the "Unknown node" error.

Acceptance criteria

  • Unknown node and auth failure return isError: true with the cause
  • Failed checks include the reason
  • Invalid HOMELAB_NODES produces a clear error
  • Tests cover each case

Getting started

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

Filed by repo-audit/full-audit at 9cfe5e3. Severity: medium. Effort: S. audit-key: bug|mcp-server/src/tools/diagnostics.ts|collect

Activity

  1. added
    bug
    severity: medium
    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

    bugseverity: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions