Skip to content

Detect SSH auth failure on private-repo deploy and emit clear error#742

Merged
kriszyp merged 2 commits into
mainfrom
kris/nice-tu-20cd54
May 23, 2026
Merged

Detect SSH auth failure on private-repo deploy and emit clear error#742
kriszyp merged 2 commits into
mainfrom
kris/nice-tu-20cd54

Conversation

@kriszyp
Copy link
Copy Markdown
Member

@kriszyp kriszyp commented May 22, 2026

Closes HarperFast/harper-pro#185

Summary

When npm pack fails with git exit 128 due to SSH auth issues, the raw npm/git stderr was passed through as-is — leaving users to dig through error noise to find the actual cause.

This detects four SSH failure patterns in the subprocess stderr:

  • Could not read from remote repository
  • Permission denied (publickey)
  • No user exists for uid (SSH daemon not configured)
  • Host key verification failed (host not in known_hosts)

…and replaces the raw passthrough with a single actionable error:

Failed to deploy private repository <pkg>: SSH authentication failed. Verify the repository URL, configure an SSH key on this Harper instance, and ensure it has access to the target repository.

Original stderr is preserved via the error cause chain for debugging.

Notes

  • No new dependencies; purely string matching in cold-path error handling.
  • isSSHAuthFailure is exported for unit testing (6 cases, all passing).
  • Deploy docs update (acceptance criteria item 2) should follow in the documentation repo.

Cross-model review (Gemini) suggested: adding Host key verification failed pattern (done), cause chaining (done), and URL verification language in the message (done). statusCode on the thrown error was considered but skipped — the existing validation errors in this file don't use it, and the issue only requires a clear message in the API response.

🤖 Generated by Claude Sonnet 4.6

When npm pack fails with git exit 128 due to SSH auth issues (missing key,
publickey denied, host key unverified, or missing SSH uid), translate the
raw npm/git stderr passthrough into a single actionable error message that
tells the user to configure their SSH key. Original stderr is preserved via
the error cause chain.

Closes #185

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The prior message only mentioned SSH key configuration, which would
mislead users hitting a host-key verification failure (the newly added
Host key verification failed pattern). Broaden to also point at
ssh/known_hosts so all four detected failure modes are covered.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 22, 2026

Reviewed; no blockers found.

@kriszyp kriszyp marked this pull request as ready for review May 22, 2026 15:43
@kriszyp kriszyp requested review from DavidCockerill and removed request for kylebernhardy May 22, 2026 20:03
@kriszyp kriszyp merged commit 9a20ba6 into main May 23, 2026
38 checks passed
@kriszyp kriszyp deleted the kris/nice-tu-20cd54 branch May 23, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Private repo deploy: clearer error when SSH key is missing or unauthorized

2 participants