Skip to content

[Bug]: GitHub repository lookup rejects a bare repo name and hides the reason behind a generic error #17230

Description

@josephv123

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Sign in to GitHub on the server (gh auth login or GH_TOKEN).
  2. Open the command palette → Add project → Clone from GitHub.
  3. Type a bare repository name you own, e.g. myrepo instead of you/myrepo, and press Enter.

Expected behavior

The lookup finds <viewer>/myrepo, as it did before #16321. That PR moved lookup from gh repo view <input> to the GitHub API, and gh repo view myrepo treats a bare name as belonging to the signed-in account. createRepository in the same provider already does this through readViewerLogin.

If the input can't be used, the toast should say why.

Actual behavior

The toast shows a generic error:

Source control repository operation lookupRepository failed for github: The source control operation could not be completed.

There are two causes:

  1. getRepositoryCloneUrls passes the input to parseGitHubRepositorySelector. That function accepts only owner/name, host/owner/name, or a URL, and returns null for a single segment. The provider then fails with "Repositories are named owner/name." No request reaches GitHub. Before feat(server): source control, media and discovery use GitHub's API instead of gh #16321, gh resolved the bare name to the viewer's repository, so this is a regression. createRepository handles the same input by falling back to readViewerLogin.
  2. mapRepositoryError replaces every provider failure with the generic detail. The only exception is Bitbucket's locator error, which fix(server): reject invalid explicit Bitbucket repositories #15876 added after [Bug]: Bitbucket repository lookup of a name without workspace fails with a generic error instead of a validation message #15193. As a result, the GitHub provider's user-facing details never reach the client. These include "Repositories are named owner/name." and REPOSITORY_NOT_FOUND, so a mistyped owner/name also gets the generic toast. The real reason appears only in server.trace.ndjson.

Possible fix:

  • When the selector is a single segment, use readViewerLogin(fallbackHost) as the owner, as createRepository does.
  • In mapRepositoryError, pass through the detail of a SourceControlProviderError whose provider failure is user-facing, instead of special-casing one provider at a time.

Related: #15193 (the same masking for Bitbucket) and #7849.

Impact

Minor bug or occasional failure

Version or commit

0.0.46-nightly.20261008.2819 server; same code on main @ 9a3070b

Environment

Ubuntu server (systemd service) reached from the macOS T3 Code (Nightly) desktop app over T3 Connect. The failure happens on the server and doesn't depend on the client.

Logs or stack traces

SourceControlRepositoryError: Source control repository operation lookupRepository failed for github: The source control operation could not be completed.
  [cause]: SourceControlProviderError: Source control provider github failed in getRepositoryCloneUrls: Repositories are named owner/name.

On the same machine, gh repo view myrepo --json nameWithOwner returns {"nameWithOwner":"<viewer>/myrepo"}.

Workaround

Enter the repository as owner/name, or paste the GitHub URL.

Activity

  1. juliusmarminge commented on Oct 8, 2026

    @juliusmarminge
    Member

    Note

    Grok responding on behalf of Julius.

    Thanks for the detailed report. I checked it against main at 9a3070b, and both halves look accurate.

    1. Bare names stopped resolving to your own account (looks like a regression from #16321)

    2. The reason gets replaced by a generic message

    • mapRepositoryError replaces every provider detail with "The source control operation could not be completed." (L104). The one exception is Bitbucket's locator error, added in fix(server): reject invalid explicit Bitbucket repositories #15876. A test pins this behavior for a GitHub lookup failure (SourceControlRepositoryService.test.ts:151-154).
    • The masking appears deliberate. It came from [codex] structure source-control repository failures #3336, which keeps raw provider text on cause so nothing sensitive reaches clients. Since then, though, the GitHub provider has started writing its detail as user-facing text (L262-L271). So messages like "Repositories are named owner/name." and "Repository not found. Check the owner and name and try again." are written for users but don't appear to reach them.
    • One caveat for the fix: passing every GitHub detail through wouldn't be completely safe. For request and response errors, L304-L308 forwards error.message. A small allowlist of fixed messages (format, not found, auth, rate limit), or a marker on the error saying it's safe for users, would fit the [codex] structure source-control repository failures #3336 intent better.

    Client side: both clients hint at the format. Web's prompt reads "Enter GitHub repository (owner/repo)" (CommandPalette.tsx:356), and mobile uses owner/repo as the placeholder (AddProjectScreen.tsx:847-850). Neither checks the input before lookup.

    Related

    I didn't find a duplicate or an existing fix PR. A likely fix: (1) when the selector is a single segment, resolve the owner with readViewerLogin(fallbackHost); (2) let a vetted set of GitHub lookup details through mapRepositoryError. Until then, the workaround of entering owner/name or pasting the URL should still work.

  2. added
    bugSomething is broken or behaving incorrectly.
    via-triageFiled through npx t3 triage
    on Oct 8, 2026
  3. Ghost-9 commented on Oct 9, 2026

    @Ghost-9

    Second independent confirmation on a different platform, plus two points that may affect the fix.

    Environment: macOS T3 Code (Nightly) desktop with its bundled server, 0.0.46-nightly.20261009.2861 — a later nightly than the report, same behaviour. gh is authenticated with repo scope, GET repos/{owner}/{name} works from the same machine, and GitHubSourceControlProvider.discovery is Success. So nothing environmental is involved: the field input never becomes a request.

    Repro: Add project → GitHub → type a bare repository name into the field whose placeholder is owner/repo → Enter. Five attempts over ~10 hours, identical every time:

    SourceControlRepositoryError: Source control repository operation lookupRepository failed for github: The source control operation could not be completed.
      [cause]: SourceControlProviderError: Source control provider github failed in getRepositoryCloneUrls: Repositories are named owner/name.
    

    Ten occurrences of that innermost line in ~/.t3/userdata/logs/server.trace.ndjson*, and the toast above is the only thing a user ever sees.

    Two points for the fix:

    1. In this path the discarded detail is a fixed literal with no user data ("Repositories are named owner/name."), unlike the request/response errors that forward error.message. So an allowlist or a "safe for users" marker, as you suggested, cleanly covers the format/not-found/auth/rate-limit strings that are already written for users.
    2. On the framing: the reason a bare name gets typed at all is that the field is the only way in — there is no repository list or search anywhere in the Add-project clone flow in the current build. Restoring the pre-feat(server): source control, media and discovery use GitHub's API instead of gh #16321 bare-name resolution therefore removes most of the real-world pain cheaply. The listing idea is tracked separately at Suggest GitHub repositories after typing an owner #15973 (Ideas, open, awaiting maintainer direction); prior attempts were fix(github): search repositories by name #8340, fix(source-control): suggest GitHub repositories by owner #10214 and feat(source-control): search GitHub repositories when cloning #13228 (all closed unmerged) and the original request [Feature]: Let users search their GitHub repositories when cloning a new project #8654 (closed not_planned).

    For anyone landing here: owner/name resolves correctly, and a full URL works only through the Git URL entry, which skips lookupRepository entirely.

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

    bugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions