From 22fabf7ba172f7d3bdeab1fbeb8cc45edaa47188 Mon Sep 17 00:00:00 2001 From: jheyworth <8269695+jheyworth@users.noreply.github.com> Date: Mon, 9 Feb 2026 00:34:16 +0000 Subject: [PATCH] fix: add error handling for CSV read/parse in loadAgentManifest and loadBmadHelp Wrap file read and csv.parse in try/catch blocks so malformed or unreadable CSV files gracefully degrade instead of aborting setup. Co-Authored-By: Claude Opus 4.6 --- .../cli/installers/lib/ide/github-copilot.js | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/tools/cli/installers/lib/ide/github-copilot.js b/tools/cli/installers/lib/ide/github-copilot.js index 84d7f7c00..4fe16f0b4 100644 --- a/tools/cli/installers/lib/ide/github-copilot.js +++ b/tools/cli/installers/lib/ide/github-copilot.js @@ -98,14 +98,18 @@ class GitHubCopilotSetup extends BaseIdeSetup { return agents; } - const csvContent = await fs.readFile(manifestPath, 'utf8'); - const records = csv.parse(csvContent, { - columns: true, - skip_empty_lines: true, - }); + try { + const csvContent = await fs.readFile(manifestPath, 'utf8'); + const records = csv.parse(csvContent, { + columns: true, + skip_empty_lines: true, + }); - for (const record of records) { - agents.set(record.name, record); + for (const record of records) { + agents.set(record.name, record); + } + } catch { + // Gracefully degrade if manifest is unreadable/malformed } return agents; @@ -123,11 +127,16 @@ class GitHubCopilotSetup extends BaseIdeSetup { return null; } - const csvContent = await fs.readFile(helpPath, 'utf8'); - return csv.parse(csvContent, { - columns: true, - skip_empty_lines: true, - }); + try { + const csvContent = await fs.readFile(helpPath, 'utf8'); + return csv.parse(csvContent, { + columns: true, + skip_empty_lines: true, + }); + } catch { + // Gracefully degrade if help CSV is unreadable/malformed + return null; + } } /**