diff --git a/scripts/features/lib/github.mjs b/scripts/features/lib/github.mjs index c4f212dfd5..800708db42 100644 --- a/scripts/features/lib/github.mjs +++ b/scripts/features/lib/github.mjs @@ -7,7 +7,13 @@ import { execFileSync } from "node:child_process"; function runJson(cmd, args) { const out = execFileSync(cmd, args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }); - return JSON.parse(out); + try { + return JSON.parse(out); + } catch (e) { + throw new Error( + `Failed to parse JSON from ${cmd}: ${e.message}\nOutput (first 200 chars): ${out.slice(0, 200)}` + ); + } } function runText(cmd, args) {