diff --git a/packages/core/src/UserSettings.ts b/packages/core/src/UserSettings.ts index dd97b9f406..af32d5e36c 100644 --- a/packages/core/src/UserSettings.ts +++ b/packages/core/src/UserSettings.ts @@ -159,9 +159,14 @@ export async function getUserSettings(settingsPath?: string, ignoreCache?: boole } const settingsFile = await fsReadFile(settingsPath, 'utf8'); - settingsCache = JSON.parse(settingsFile); - return JSON.parse(settingsFile) as IUserSettings; + try { + settingsCache = JSON.parse(settingsFile); + } catch (error) { + throw new Error(`Error parsing n8n-config file "${settingsPath}". It does not seem to be valid JSON.`); + } + + return settingsCache as IUserSettings; }