FlowiseAI/Flowise · error · Error

Invalid JSON in the Additional Configuration: ${exception}

Error message

Invalid JSON in the Additional Configuration: ${exception}

What it means

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.

Source

Thrown at packages/components/nodes/recordmanager/PostgresRecordManager/PostgresRecordManager.ts:154

    async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
        const credentialData = await getCredentialData(nodeData.credential ?? '', options)
        const user = getCredentialParam('user', credentialData, nodeData, process.env.POSTGRES_RECORDMANAGER_USER)
        const password = getCredentialParam('password', credentialData, nodeData, process.env.POSTGRES_RECORDMANAGER_PASSWORD)
        const tableName = sanitizeRecordManagerTableName(getTableName(nodeData))
        const additionalConfig = nodeData.inputs?.additionalConfig as string
        const _namespace = nodeData.inputs?.namespace as string
        const namespace = _namespace ? sanitizeRecordManagerNamespace(_namespace) : options.chatflowid
        const cleanup = nodeData.inputs?.cleanup as string
        const _sourceIdKey = nodeData.inputs?.sourceIdKey as string
        const sourceIdKey = _sourceIdKey ? _sourceIdKey : 'source'

        let additionalConfiguration = {}
        if (additionalConfig) {
            try {
                additionalConfiguration = typeof additionalConfig === 'object' ? additionalConfig : JSON.parse(additionalConfig)
            } catch (exception) {
                throw new Error('Invalid JSON in the Additional Configuration: ' + exception)
            }
            additionalConfiguration = sanitizeDataSourceOptions(additionalConfiguration)
        }

        const postgresConnectionOptions = mergeDataSourceOptions(
            {
                type: 'postgres',
                host: getHost(nodeData),
                port: getPort(nodeData),
                ssl: getSSL(nodeData),
                username: user,
                password: password,
                database: getDatabase(nodeData)
            },
            additionalConfiguration
        )

        const args = {

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Validate the additionalConfig string in a JSON linter before saving the node.
  2. Use double quotes for all keys and string values; remove trailing commas and comments.
  3. If you only need a few keys, prefer the structured credential fields over free-form JSON.
  4. Read the appended exception message - it pinpoints the parse position.

Example fix

// before (invalid JSON)
{ host: 'localhost', port: 5432, }
// after (valid JSON)
{"host":"localhost","port":5432}
Defensive patterns

Strategy: validation

Validate before calling

function parseAdditionalConfig(raw: string): Record<string, unknown> {
  try {
    return JSON.parse(raw)
  } catch (e) {
    throw new Error(`additionalConfig is not valid JSON: ${(e as Error).message}`)
  }
}
// validate at the form layer before save:
parseAdditionalConfig(formData.additionalConfig)

Type guard

function isJsonString(s: unknown): s is string {
  if (typeof s !== 'string') return false
  try { JSON.parse(s); return true } catch { return false }
}

Try / catch

// Already wrapped internally; callers of init should catch and surface to the UI.
try {
  await pgManager.init(nodeData, input, options)
} catch (e) {
  if (e instanceof Error && e.message.startsWith('Invalid JSON in the Additional Configuration')) {
    // show the parse error position to the user
  }
  throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/ab972cc88cec278e. Report an issue: GitHub.