Skip to content

Improve error message when branch doesn't exist (e.g., suggest trying master) #3

@ivan-magda

Description

@ivan-magda

Description

When fetching a repository fails due to an incorrect branch name, the error message "GitHub API Error:" provides no actionable guidance to the user.

Steps to Reproduce

  1. Go to https://githubtree.mgks.dev
  2. Enter matteocrippa/awesome-swift
  3. Leave branch as main (default)
  4. Click "Fetch"
  5. See unhelpful error: "GitHub API Error:"

Current Behavior

Image
  • Generic "GitHub API Error:" message with no details
  • User has no idea what went wrong or how to fix it

Suggested Improvement

When a 422 error occurs on the commits endpoint, display a more helpful message like:

Branch not found. The branch main doesn't exist in this repository. Try master or check the repository for available branches.

Or even better — auto-detect the default branch using the Repos API which returns a default_branch field.

Environment

  • Browser: Chrome
  • Date: Jan 4, 2026

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions