diff --git a/apps/server/src/wsServer.ts b/apps/server/src/wsServer.ts index 1b1d560d1b..744991cc4c 100644 --- a/apps/server/src/wsServer.ts +++ b/apps/server/src/wsServer.ts @@ -35,6 +35,7 @@ import { FileSystem, Layer, Path, + PlatformError, Ref, Result, Schema, @@ -790,6 +791,17 @@ export const createServer = Effect.fn(function* (): Effect.fn.Return< message: `Workspace directory already exists: ${target.relativePath}`, }); } + if ( + !( + existingEntry.failure instanceof PlatformError.PlatformError && + existingEntry.failure.reason instanceof PlatformError.SystemError && + existingEntry.failure.reason._tag === "NotFound" + ) + ) { + return yield* new RouteRequestError({ + message: `Failed to inspect workspace directory: ${String(existingEntry.failure)}`, + }); + } yield* fileSystem .makeDirectory(path.dirname(target.absolutePath), { recursive: true })