From 7bd91a19a060543fc39131f0931f5e54477cdaf9 Mon Sep 17 00:00:00 2001 From: Matthew Jackson Date: Fri, 6 Mar 2026 15:11:32 -0800 Subject: [PATCH] Fix maxRetries not defined crash in handleResult The stuck/incomplete retry logic referenced maxRetries which was only defined in main() scope, not in handleResult(). Compute it locally. Co-Authored-By: Claude Opus 4.6 --- job_applier.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/job_applier.mjs b/job_applier.mjs index 9a9513f..59f4d44 100644 --- a/job_applier.mjs +++ b/job_applier.mjs @@ -337,8 +337,9 @@ async function handleResult(job, result, results, settings, profile, apiKey) { case 'stuck': case 'incomplete': { const retries = (job.retry_count || 0) + 1; - if (retries <= maxRetries) { - console.log(` ⏭️ ${status} — will retry (attempt ${retries}/${maxRetries})`); + const maxRetry = settings.max_retries ?? DEFAULT_MAX_RETRIES; + if (retries <= maxRetry) { + console.log(` ⏭️ ${status} — will retry (attempt ${retries}/${maxRetry})`); updateJobStatus(job.id, 'new', { title, company, retry_count: retries }); } else { console.log(` ⏭️ ${status} — max retries reached`);