diff --git a/bin/gstack-memory-ingest.ts b/bin/gstack-memory-ingest.ts index 56b072b2b..e6934ae45 100644 --- a/bin/gstack-memory-ingest.ts +++ b/bin/gstack-memory-ingest.ts @@ -819,6 +819,11 @@ function gbrainPutPage(page: PageRecord): { ok: boolean; error?: string } { body, ].join("\n"); } + // Strip NUL bytes — Postgres rejects 0x00 in UTF-8 text columns. Some Claude + // Code transcripts contain NUL inside user-pasted content or tool output, and + // surfacing those as `internal_error: invalid byte sequence` from the brain + // is unhelpful when we can sanitize at write time. + body = body.replace(/\x00/g, ""); try { execFileSync("gbrain", ["put", page.slug], { input: body,