From 0f1a582bd853073ce3837de039dc6a865f5f822b Mon Sep 17 00:00:00 2001 From: Kaparthy Reddy Date: Tue, 2 Jun 2026 10:26:27 +0530 Subject: [PATCH] fix: add maxBuffer 10MB to execFileAsync calls in routes.ts - execFileAsync was called with no maxBuffer option on both the preview and full assessment endpoints, defaulting to Node.js's 1MB stdout limit - Verbose Python output (scikit-learn/numpy deprecation warnings, model loading logs) can exceed 1MB causing ERR_CHILD_PROCESS_STDIO_MAXBUFFER which is silently caught and returned as a 500 to the user - Set maxBuffer to 10 * 1024 * 1024 (10MB) on both execFileAsync calls to safely handle verbose Python stdout without crashing Fixes #476 --- server/routes.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/routes.ts b/server/routes.ts index c35b8711a..71c1cb61b 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -562,7 +562,11 @@ export async function registerRoutes( getPythonExecutable(), [analyzePyPath, "predict_file", tempFile], { - timeout: 30000 + timeout: 30000, + // 10MB buffer to safely handle verbose Python stdout + // (scikit-learn/numpy deprecation warnings, model loading logs) + // without crashing with ERR_CHILD_PROCESS_STDIO_MAXBUFFER. + maxBuffer: 10 * 1024 * 1024, } ); prediction = JSON.parse(stdout.trim()); @@ -651,7 +655,11 @@ export async function registerRoutes( getPythonExecutable(), [analyzePyPath, "predict_file", tempFile], { - timeout: 30000 + timeout: 30000, + // 10MB buffer to safely handle verbose Python stdout + // (scikit-learn/numpy deprecation warnings, model loading logs) + // without crashing with ERR_CHILD_PROCESS_STDIO_MAXBUFFER. + maxBuffer: 10 * 1024 * 1024, } ); prediction = JSON.parse(stdout.trim());