{"record":{"id":"ab972cc88cec278e","repo":"FlowiseAI/Flowise","slug":"invalid-json-in-the-additional-configuration-ex-ab972c","errorCode":null,"errorMessage":"Invalid JSON in the Additional Configuration: ${exception}","messagePattern":"Invalid JSON in the Additional Configuration: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/recordmanager/PostgresRecordManager/PostgresRecordManager.ts","lineNumber":154,"sourceCode":"\n    async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {\n        const credentialData = await getCredentialData(nodeData.credential ?? '', options)\n        const user = getCredentialParam('user', credentialData, nodeData, process.env.POSTGRES_RECORDMANAGER_USER)\n        const password = getCredentialParam('password', credentialData, nodeData, process.env.POSTGRES_RECORDMANAGER_PASSWORD)\n        const tableName = sanitizeRecordManagerTableName(getTableName(nodeData))\n        const additionalConfig = nodeData.inputs?.additionalConfig as string\n        const _namespace = nodeData.inputs?.namespace as string\n        const namespace = _namespace ? sanitizeRecordManagerNamespace(_namespace) : options.chatflowid\n        const cleanup = nodeData.inputs?.cleanup as string\n        const _sourceIdKey = nodeData.inputs?.sourceIdKey as string\n        const sourceIdKey = _sourceIdKey ? _sourceIdKey : 'source'\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 postgresConnectionOptions = mergeDataSourceOptions(\n            {\n                type: 'postgres',\n                host: getHost(nodeData),\n                port: getPort(nodeData),\n                ssl: getSSL(nodeData),\n                username: user,\n                password: password,\n                database: getDatabase(nodeData)\n            },\n            additionalConfiguration\n        )\n\n        const args = {","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/recordmanager/PostgresRecordManager/PostgresRecordManager.ts#L136-L172","documentation":"Thrown by PostgresRecordManager.init when the node's additionalConfig input is a non-empty string that JSON.parse cannot evaluate. The manager tries object-pass-through first, then falls back to JSON.parse; only string-parse failures reach this catch. The original parse exception is concatenated to the message.","triggerScenarios":"User types a JavaScript object literal ({host: 'x'}) instead of JSON ({\"host\":\"x\"}); trailing comma; single-quoted strings; unquoted keys; a stray semicolon; copy-paste from a .ts file.","commonSituations":"Single quotes in JSON; trailing commas (forbidden in JSON, allowed in JS); comments in JSON; smart quotes from a word processor; partial paste that cut off a closing brace.","solutions":["Validate the additionalConfig string in a JSON linter before saving the node.","Use double quotes for all keys and string values; remove trailing commas and comments.","If you only need a few keys, prefer the structured credential fields over free-form JSON.","Read the appended exception message - it pinpoints the parse position."],"exampleFix":"// before (invalid JSON)\n{ host: 'localhost', port: 5432, }\n// after (valid JSON)\n{\"host\":\"localhost\",\"port\":5432}","handlingStrategy":"validation","validationCode":"function parseAdditionalConfig(raw: string): Record<string, unknown> {\n  try {\n    return JSON.parse(raw)\n  } catch (e) {\n    throw new Error(`additionalConfig is not valid JSON: ${(e as Error).message}`)\n  }\n}\n// validate at the form layer before save:\nparseAdditionalConfig(formData.additionalConfig)","typeGuard":"function isJsonString(s: unknown): s is string {\n  if (typeof s !== 'string') return false\n  try { JSON.parse(s); return true } catch { return false }\n}","tryCatchPattern":"// Already wrapped internally; callers of init should catch and surface to the UI.\ntry {\n  await pgManager.init(nodeData, input, options)\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Invalid JSON in the Additional Configuration')) {\n    // show the parse error position to the user\n  }\n  throw e\n}","preventionTips":["Validate additionalConfig with JSON.parse on the client before saving the node.","Provide a structured form for the common Postgres options instead of free JSON.","Lint pasted JSON for trailing commas and single quotes."],"tags":["postgres","record-manager","json","config","user-input"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}