Skip to content

Bug Report: ContributorProfile crashes when GitHub API returns error response #622

@Dhruvg0

Description

@Dhruvg0

📜 Description

Description

When the GitHub API returns an error (e.g., user not found, rate limit exceeded),
the response is an object like { message: 'Not Found' } instead of a valid user
profile. The component attempts to access profile.avatar_url on this error object,
causing a runtime crash and blank UI.

Steps to Reproduce

  1. Enter an invalid or non-existent GitHub username in the search
  2. Observe the app crash instead of showing an error message

Expected Behavior

An error message is shown to the user (e.g., "User not found")

Actual Behavior

Component crashes trying to read avatar_url from { message: 'Not Found' }

File

src/components/ContributorProfile.tsx — line 36

Proposed Fix

Add an API error check immediately after the fetch:

if (userData.message) throw new Error(userData.message);

Environment

  • Affects all browsers

What browsers are you seeing the problem on?

No response

📃 Relevant Screenshots (Links)

No response

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions