Skip to content

[Bug]: Repository lookup still hides "not found" behind "The source control operation could not be completed." #31237

Closed

Description

@bmmmm

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

Follow-up to #17230. The bare-name part was fixed in #17379; the maintainer asked for a new issue for "generic errors still hide reasons for other lookup failures".

  1. Add project → Clone from Forgejo, enter a name that does not exist under the signed-in account, e.g. type.
  2. Same with GitHub (type, qwed).

Expected behavior

The toast says why the lookup failed and which repository was tried, e.g. "Repository <viewer>/type was not found…". This matters most for bare names: they resolve to the signed-in account, so a user who expects an org repository can't see that <viewer>/type was tried.

Actual behavior

Both toasts are generic:

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

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

The server knows the reason; server.trace.ndjson has it:

  • GitHub: …getRepositoryCloneUrls: Repository not found. Check the owner and name and try again. (GET /repos/<viewer>/type → 404)
  • Forgejo: …getRepositoryCloneUrls: Forgejo repository or pull request was not found. (GET /api/v1/repos/<viewer>/type → 404); the inner ForgejoCliError span has an empty message.

Cause: mapRepositoryError in apps/server/src/sourceControl/SourceControlRepositoryService.ts forwards only userFacingSourceControlDetail(cause.cause). GitHub's not-found failure (REPOSITORY_NOT_FOUND, a plain Error) and Forgejo's ForgejoCliError (reason not-found) set no userFacingDetail, so the generic fallback always wins.

GitLab, Bitbucket and GitCafe follow the same path (verified with unit tests only). I have a fix ready (GitHub, Forgejo, GitLab, Bitbucket and GitCafe set a fixed userFacingDetail for a genuine not-found in getRepositoryCloneUrls, allowlist unchanged; Azure DevOps can't tell not-found from missing permission and stays generic) and will open a PR referencing this issue. With it the toasts read e.g. "Repository <viewer>/vouch was not found. Check the owner and name and try again."

Impact

Minor bug or occasional failure

Version or commit

0.1.8-nightly.20261104.4179

Environment

Linux server (Ubuntu 24.04), gh signed in to github.com, tea/fj signed in to a self-hosted Forgejo.

Logs or stack traces

# server.trace.ndjson, span name / exit cause (first line), reproduced on main @ 4b87a45770
GET  https://<forgejo-host>/api/v1/repos/<viewer>/gewfdf  -> 404
ForgejoCli.requestFj                                 ForgejoCliError: 
ForgejoSourceControlProvider.getRepositoryCloneUrls  SourceControlProviderError: Source control provider forgejo failed in getRepositoryCloneUrls: Forgejo repository or pull request was not found.
ws.rpc.sourceControl.lookupRepository                SourceControlRepositoryError: Source control repository operation lookupRepository failed for forgejo: The source control operation could not be completed.

GitHubRest.send  GET /repos/<viewer>/vauv  -> 404    GitHubApiNotFoundError: GitHub could not find the requested resource, or the credential cannot see it.
GitHubSourceControlProvider.getRepositoryCloneUrls   SourceControlProviderError: Source control provider github failed in getRepositoryCloneUrls: Repository not found. Check the owner and name and try again.
ws.rpc.sourceControl.lookupRepository                SourceControlRepositoryError: Source control repository operation lookupRepository failed for github: The source control operation could not be completed.

Workaround

Enter the full owner/name or the clone URL.

Cheers, bm

Activity

  1. felix920506 commented on Nov 16, 2026

    @felix920506

    Same masking also hits publishRepository, seen on 0.1.9 (still the same on main).

    Retrying Publish after a partial failure (the repo was already created on GitHub) calls createRepository again. GitHub answers POST /user/repos → 422 Repository creation failed.; name already exists on this account, and the trace has that text on GitHubSourceControlProvider.createRepository. The user only sees:

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

    The cause is the same: mapRepositoryError in SourceControlRepositoryService.ts only passes through provider errors with userFacingDetail, and a GitHub 422 on repo creation has none. A fixed message for "a repository with that name already exists on this account" would have told the user what to do. The non-resumable Publish retry itself is filed separately: #37540.

    Comment by Claude Code (Opus 5.5) via t3 triage.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions