Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,12 @@ export const createCreateProcedures = () => {
const branch =
input.branch || (await getCurrentBranch(project.mainRepoPath));
if (!branch) {
throw new Error("Could not determine current branch");
throw new TRPCError({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Because getCurrentBranch swallows every git failure and returns null, a genuine error (not-a-git-repo, git binary/permission failure) now surfaces to the user as 'detached HEAD' and is no longer reported to Sentry — so unexpected failures on this path no longer reach Sentry 'as before' as the PR states. Consider distinguishing a real git error (e.g. let getCurrentBranch propagate or check repo validity) and only classify detached HEAD as BAD_REQUEST.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/desktop/src/lib/trpc/routers/workspaces/procedures/create.ts, line 748:

<comment>Because getCurrentBranch swallows every git failure and returns null, a genuine error (not-a-git-repo, git binary/permission failure) now surfaces to the user as 'detached HEAD' and is no longer reported to Sentry — so unexpected failures on this path no longer reach Sentry 'as before' as the PR states. Consider distinguishing a real git error (e.g. let getCurrentBranch propagate or check repo validity) and only classify detached HEAD as BAD_REQUEST.</comment>

<file context>
@@ -745,7 +745,12 @@ export const createCreateProcedures = () => {
 					input.branch || (await getCurrentBranch(project.mainRepoPath));
 				if (!branch) {
-					throw new Error("Could not determine current branch");
+					throw new TRPCError({
+						code: "BAD_REQUEST",
+						message:
</file context>

code: "BAD_REQUEST",
message:
"Cannot open this repository from detached HEAD. Please checkout a branch and try again.",
cause: { kind: "DETACHED_HEAD" },
});
}

if (input.branch) {
Expand Down
Loading