Skip to content

The open source coding agent.

TypeScript

core: prevent crash when starting in repositories without any commits yet

Dax Raad85f15893bcd5
diff --git a/packages/opencode/src/project/project.ts b/packages/opencode/src/project/project.ts
index 8d94a5a1243..381559e80b8 100644
--- a/packages/opencode/src/project/project.ts
+++ b/packages/opencode/src/project/project.ts
@@ -60,7 +60,7 @@ export namespace Project {
.toSorted(),
)
id = roots[0]
- Bun.file(path.join(git, "opencode")).write(id)
+ if (id) Bun.file(path.join(git, "opencode")).write(id)
}
timer.stop()
if (!id) {