The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 22:15 UTC
fix(server): say Git isn't installed when a new project can't run git (#28219)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 11, 2026 at 12:02 UTC
28bbc91c7c2b349d701fe10751e2ed4245171a69
2 files changed
+49
-2
apps/server/src/project/ManagedProjectFolders.test.ts
+37
-1
@@ -12,6 +12,7 @@ import * as Logger from "effect/Logger";
12
import * as Option from "effect/Option";
13
import * as Path from "effect/Path";
14
import * as PlatformError from "effect/PlatformError";
15
+import { ChildProcessSpawner } from "effect/process";
16
import * as Scope from "effect/Scope";
17
18
import * as ServerConfig from "../config.ts";
@@ -55,7 +56,7 @@ const layerRealGit = GitVcsDriver.layer.pipe(Layer.provide(VcsProcess.layer));
56
57
interface HarnessOptions {
58
readonly vcsProcess?: Layer.Layer<VcsProcess.VcsProcess>;
58
- readonly git?: Layer.Layer<GitVcsDriver.GitVcsDriver>;
59
+ readonly git?: typeof layerRealGit;
60
readonly projects?: (
61
real: ProjectService.ProjectService["Service"],
62
) => ProjectService.ProjectService["Service"];
@@ -450,6 +451,41 @@ it.effect("keeps a named project and reports why when Git cannot commit", () =>
451
),
452
);
453
454
+it.effect("says Git is not installed when a named project cannot start Git", () =>
455
+ withScratch(
456
+ () =>
457
+ Effect.gen(function* () {
458
+ const folders = yield* ManagedProjectFolders.ManagedProjectFolders;
459
+
460
+ const failure = yield* Effect.flip(folders.createNamedProject({ name: "T3Code Test" }));
461
+
462
+ assert.strictEqual(
463
+ failure.message,
464
+ "Git isn't installed on this machine. Install Git to create a project.",
465
+ );
466
+ }),
467
+ {
468
+ git: GitVcsDriver.layer.pipe(
469
+ Layer.provide(
470
+ Layer.succeed(
471
+ ChildProcessSpawner.ChildProcessSpawner,
472
+ ChildProcessSpawner.make(() =>
473
+ Effect.fail(
474
+ PlatformError.systemError({
475
+ _tag: "NotFound",
476
+ module: "ChildProcess",
477
+ method: "spawn",
478
+ syscall: "spawn git",
479
+ }),
480
+ ),
481
+ ),
482
+ ),
483
+ ),
484
+ ),
485
+ },
486
+ ),
487
+);
488
+
489
it.effect("keeps a folder that another project owns when the create conflicts", () =>
490
withScratch(({ baseDir }) =>
491
withGitEnv(
apps/server/src/project/ManagedProjectFolders.ts
+12
-1
@@ -1,5 +1,6 @@
1
import {
2
CommandId,
3
+ GitCommandError,
4
type GitManagerServiceError,
5
ProjectId,
6
type ThreadId,
@@ -67,6 +68,14 @@ export class ScratchProjectError extends Schema.TaggedError<ScratchProjectError>
68
69
export type ScratchError = ScratchUnavailableError | ScratchFolderError | ScratchProjectError;
70
71
+// The spawner checks cwd before spawning, so NotFound from spawn itself means a missing executable.
72
+const isMissingExecutable = (cause: unknown) =>
73
+ PlatformError.isPlatformError(cause) &&
74
+ cause.reason._tag === "NotFound" &&
75
+ cause.reason.method === "spawn";
76
+
77
+const isGitCommandError = Schema.is(GitCommandError);
78
+
79
export class NamedProjectFolderError extends Schema.TaggedError<NamedProjectFolderError>()(
80
"NamedProjectFolderError",
81
{
@@ -75,7 +84,9 @@ export class NamedProjectFolderError extends Schema.TaggedError<NamedProjectFold
84
},
85
) {
86
override get message(): string {
78
- return "Failed to create the project folder.";
87
+ return isGitCommandError(this.cause) && isMissingExecutable(this.cause.cause)
88
+ ? "Git isn't installed on this machine. Install Git to create a project."
89
+ : "Failed to create the project folder.";
90
}
91
}
92