{"record":{"id":"c7f01ead856917fc","repo":"FlowiseAI/Flowise","slug":"invalid-json-in-the-additional-configuration","errorCode":null,"errorMessage":"Invalid JSON in the Additional Configuration: ","messagePattern":"Invalid JSON in the Additional Configuration: ","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/memory/AgentMemory/AgentMemory.ts","lineNumber":123,"sourceCode":"            }\n        ]\n    }\n\n    async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {\n        const additionalConfig = nodeData.inputs?.additionalConfig as string\n        const databaseFilePath = nodeData.inputs?.databaseFilePath as string\n        const databaseType = nodeData.inputs?.databaseType as string\n        const databaseEntities = options.databaseEntities as IDatabaseEntity\n        const chatflowid = options.chatflowid as string\n        const orgId = options.orgId as string\n        const appDataSource = options.appDataSource as DataSource\n\n        let additionalConfiguration = {}\n        if (additionalConfig) {\n            try {\n                additionalConfiguration = typeof additionalConfig === 'object' ? additionalConfig : JSON.parse(additionalConfig)\n            } catch (exception) {\n                throw new Error('Invalid JSON in the Additional Configuration: ' + exception)\n            }\n            additionalConfiguration = sanitizeDataSourceOptions(additionalConfiguration)\n        }\n\n        const threadId = options.sessionId || options.chatId\n\n        let datasourceOptions: ICommonObject = {\n            ...additionalConfiguration,\n            type: databaseType\n        }\n\n        if (databaseType === 'sqlite') {\n            datasourceOptions.database = databaseFilePath\n                ? validateSQLitePath(databaseFilePath)\n                : path.join(process.env.DATABASE_PATH ?? path.join(getUserHome(), '.flowise'), 'database.sqlite')\n            const args: SaverOptions = {\n                datasourceOptions,\n                threadId,","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/memory/AgentMemory/AgentMemory.ts#L105-L141","documentation":"AgentMemory.init parses additionalConfig via JSON.parse only when it is a non-object value; a SyntaxError is caught and re-thrown. The parsed object is then passed through sanitizeDataSourceOptions and spread into datasourceOptions.","triggerScenarios":"Free-form Additional Configuration string in the AgentMemory node that is not valid JSON, e.g. a TypeORM options object literal pasted verbatim.","commonSituations":"Pasting {ssl:true, extra:{...}} with unquoted keys or trailing commas; mixing JS syntax into a JSON field; curly-quote corruption.","solutions":["Validate additionalConfig as JSON in the UI before saving.","Pass additionalConfig as an object to skip the parse branch.","Lint the JSON to locate the syntax error."],"exampleFix":"// before\n{ ssl: true, extra: { connectionLimit: 5 } }\n// after\n{\"ssl\":true,\"extra\":{\"connectionLimit\":5}}","handlingStrategy":"validation","validationCode":"function parseAdditionalConfig(raw: unknown): Record<string, unknown> {\n  if (raw == null) return {}\n  if (typeof raw === 'object') return raw as Record<string, unknown>\n  return JSON.parse(raw as string) // throws SyntaxError early\n}","typeGuard":"function isJsonString(v: string): v is string {\n  try { JSON.parse(v); return true } catch { return false }\n}","tryCatchPattern":"try {\n  additionalConfiguration = typeof additionalConfig === 'object' ? additionalConfig : JSON.parse(additionalConfig)\n} catch (e) {\n  throw new Error(`Additional Configuration is not valid JSON: ${(e as Error).message}`)\n}","preventionTips":["Validate datasource option JSON in the UI before saving.","Pass an object when the API allows it.","Lint JSON configs in CI.","Avoid pasting JS object literals."],"tags":["agent-memory","memory","json","validation","datasource","parsing"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}