From 9ea51745a7cf2c0c2f6cc2bf9696644f74600317 Mon Sep 17 00:00:00 2001 From: TejaChitturi Date: Mon, 30 Mar 2026 10:58:26 +0530 Subject: [PATCH 1/2] [RQ-1116]: Failed to initialize FsManage : Could not load config from requestly.json --- src/renderer/actions/local-sync/fs-manager.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/renderer/actions/local-sync/fs-manager.ts b/src/renderer/actions/local-sync/fs-manager.ts index 0bd21e1..79def5d 100644 --- a/src/renderer/actions/local-sync/fs-manager.ts +++ b/src/renderer/actions/local-sync/fs-manager.ts @@ -133,10 +133,17 @@ export class FsManager { type: "file", }); const rawConfig = readFileSync(configFile.path); + + // If config file doesn't exist, return a default config if (rawConfig.type === "error") { - throw new Error( - `Could not load config from ${CONFIG_FILE}. ${rawConfig.error.message}` + console.log( + `Could not load config from ${CONFIG_FILE}. ${rawConfig.error.message} Using default configuration.` ); + const defaultConfig: Static = { + version: WORKSPACE_CONFIG_FILE_VERSION, + exclude: [], + }; + return defaultConfig; } const parsedConfig = parseJsonContent(rawConfig.content, Config); if (parsedConfig.type === "error") { From 82d95ca9554cd668bf863ce046bda3aa8d7f8be0 Mon Sep 17 00:00:00 2001 From: TejaChitturi Date: Mon, 30 Mar 2026 11:25:56 +0530 Subject: [PATCH 2/2] restricted to file not found error --- src/renderer/actions/local-sync/fs-manager.ts | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/renderer/actions/local-sync/fs-manager.ts b/src/renderer/actions/local-sync/fs-manager.ts index 79def5d..e9777cb 100644 --- a/src/renderer/actions/local-sync/fs-manager.ts +++ b/src/renderer/actions/local-sync/fs-manager.ts @@ -134,16 +134,23 @@ export class FsManager { }); const rawConfig = readFileSync(configFile.path); - // If config file doesn't exist, return a default config + // Only return a default config if the error is ENOENT (file not found) if (rawConfig.type === "error") { - console.log( - `Could not load config from ${CONFIG_FILE}. ${rawConfig.error.message} Using default configuration.` - ); - const defaultConfig: Static = { - version: WORKSPACE_CONFIG_FILE_VERSION, - exclude: [], - }; - return defaultConfig; + if (rawConfig.error && rawConfig.error.code === ErrorCode.NotFound) { + console.log( + `Config file not found at ${configFile.path}. Using default configuration.` + ); + const defaultConfig: Static = { + version: WORKSPACE_CONFIG_FILE_VERSION, + exclude: [], + }; + return defaultConfig; + } else { + // For any other error (e.g., permission denied), rethrow + throw new Error( + `Could not load config from ${CONFIG_FILE}. ${rawConfig.error.message}` + ); + } } const parsedConfig = parseJsonContent(rawConfig.content, Config); if (parsedConfig.type === "error") {