📋 Description
The Setup Guide page is broken for a subset of repositories. When a user clicks "Setup Guide", the page shows:
Setup Guide: undefined/puppeteer
Error: Failed to generate setup guide: Internal Server Error
The github-service logs show the exact malformed request:
GET "/repos/undefined/puppeteer/readme" → 500
There are two root causes, both of which must be fixed for this issue to be fully resolved.
🔍 Root Cause #1 — Backend: repo_id is missing the owner
In backend/core_service/internal/orchestration/repo_search.go (line 49–53):
var results []string
for _, r := range repos {
repoID := r.FullName
if repoID == "" {
repoID = r.Name // ← BUG: r.Name is just "puppeteer" with no owner
}
results = append(results, repoID)
}
When r.FullName is empty for any reason, the fallback r.Name produces a bare repo name without an owner (e.g., "puppeteer" instead of "puppeteer/puppeteer"). This propagates through the entire recommendation pipeline.
🔍 Root Cause #2 — Frontend: Swapped owner/repo labels + no guard on split
In frontend/app/(auth)/recommendations/components/recommendationhero.tsx (line 15 and 42–43):
const [owner, repo] = repoId.split('/');
// If repoId = "puppeteer" (no slash):
// owner = "puppeteer"
// repo = undefined ← JavaScript undefined!
// Then in the JSX:
<h1>{repo}<span>/ {owner}</span></h1>
// undefined "puppeteer"
// Renders: "undefined / puppeteer"
When repo is JavaScript undefined and gets used in template literals (e.g., for navigation), it becomes the string "undefined" — which is what the URL and API call contain.
📍 Files to Change
Backend:
backend/core_service/internal/orchestration/repo_search.go
Frontend:
frontend/app/(auth)/recommendations/components/recommendationhero.tsx
frontend/app/(auth)/recommendations/components/featuredissues.tsx (secondary broken link)
✅ What To Fix
Fix 1 — repo_search.go: Remove the unsafe fallback
for _, r := range repos {
repoID := r.FullName
if repoID == "" {
// Don't fall back to r.Name — it lacks the owner and will
// cause "undefined/repo" errors downstream. Skip this entry instead.
log.Printf("SearchReposForUser: skipping repo with empty FullName: %s", r.Name)
continue
}
results = append(results, repoID)
}
Fix 2 — recommendationhero.tsx: Guard the split and fix the swapped display
// Line 15 — safe split with fallback:
const parts = repoId.split('/');
const owner = parts.length === 2 ? parts[0] : '';
const repo = parts.length === 2 ? parts[1] : parts[0];
// Line 42–43 — the display was also swapped (showing repo/owner backwards):
// Current (wrong): {repo}<span>/ {owner}</span>
// Fixed (correct): {owner}<span>/ {repo}</span>
Fix 3 — featuredissues.tsx: The "View on GitHub" button links to the issues list
// Line 87 — currently:
onClick={() => window.open(`https://github.com/${repoId}/issues`, '_blank')}
// If repoId = "puppeteer" (missing owner), this gives:
// https://github.com/puppeteer/issues → 404
// Fix: guard against missing owner/repo format:
const githubIssuesUrl = repoId.includes('/')
? `https://github.com/${repoId}/issues`
: `https://github.com/search?q=${repoId}`;
onClick={() => window.open(githubIssuesUrl, '_blank')}
🏁 Acceptance Criteria
💡 Technical Hints
- The
GitHubRepo struct (clients/github_models.go) has both FullName string and Name string. FullName is always like "owner/repo". If it's empty, something went wrong parsing the GitHub API response — the right fix is to skip/log, not to use the bare Name
- In the frontend,
"puppeteer".split("/") returns ["puppeteer"] — [1] is undefined (not the string "undefined", but actual undefined). When embedded in a template literal like `${owner}/${repo}`, JavaScript coerces it to the string "undefined" which then gets sent in the URL
- After the backend fix, verify by checking that all
repo_id values in the recommendations API response contain a /
🚀 Getting Started
- Fork the repository
- Create a branch:
git checkout -b fix/issue-34-undefined-repo-setup-guide
- Fix
backend/core_service/internal/orchestration/repo_search.go
- Fix
frontend/app/(auth)/recommendations/components/recommendationhero.tsx
- Fix
frontend/app/(auth)/recommendations/components/featuredissues.tsx
- Start the app:
docker-compose up --build + npm run dev
- Navigate to Recommendations, click a repo's Setup Guide — it should work
- Open a PR with before/after screenshots!
📋 Description
The Setup Guide page is broken for a subset of repositories. When a user clicks "Setup Guide", the page shows:
The github-service logs show the exact malformed request:
There are two root causes, both of which must be fixed for this issue to be fully resolved.
🔍 Root Cause #1 — Backend:
repo_idis missing the ownerIn
backend/core_service/internal/orchestration/repo_search.go(line 49–53):When
r.FullNameis empty for any reason, the fallbackr.Nameproduces a bare repo name without an owner (e.g.,"puppeteer"instead of"puppeteer/puppeteer"). This propagates through the entire recommendation pipeline.🔍 Root Cause #2 — Frontend: Swapped owner/repo labels + no guard on
splitIn
frontend/app/(auth)/recommendations/components/recommendationhero.tsx(line 15 and 42–43):When
repois JavaScriptundefinedand gets used in template literals (e.g., for navigation), it becomes the string"undefined"— which is what the URL and API call contain.📍 Files to Change
Backend:
backend/core_service/internal/orchestration/repo_search.goFrontend:
frontend/app/(auth)/recommendations/components/recommendationhero.tsxfrontend/app/(auth)/recommendations/components/featuredissues.tsx(secondary broken link)✅ What To Fix
Fix 1 —
repo_search.go: Remove the unsafe fallbackFix 2 —
recommendationhero.tsx: Guard the split and fix the swapped displayFix 3 —
featuredissues.tsx: The "View on GitHub" button links to the issues list🏁 Acceptance Criteria
repo_search.gono longer falls back tor.Name— repos with emptyFullNameare skipped with a log warningowner/repoin correct order (notrepo / owner)repo_idhas no/no longer showsundefinedanywhere in the UIcd frontend && npm run buildcd backend/core_service && go build ./...💡 Technical Hints
GitHubRepostruct (clients/github_models.go) has bothFullName stringandName string.FullNameis always like"owner/repo". If it's empty, something went wrong parsing the GitHub API response — the right fix is to skip/log, not to use the bareName"puppeteer".split("/")returns["puppeteer"]—[1]isundefined(not the string"undefined", but actualundefined). When embedded in a template literal like`${owner}/${repo}`, JavaScript coerces it to the string"undefined"which then gets sent in the URLrepo_idvalues in the recommendations API response contain a/🚀 Getting Started
git checkout -b fix/issue-34-undefined-repo-setup-guidebackend/core_service/internal/orchestration/repo_search.gofrontend/app/(auth)/recommendations/components/recommendationhero.tsxfrontend/app/(auth)/recommendations/components/featuredissues.tsxdocker-compose up --build+npm run dev