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 the TypeORM Postgres driver while parsing the node's `additionalConfig` input as JSON. Identical mechanics to the PGVector variant: a non-object string value is run through `JSON.parse`, and on failure the parse exception is wrapped into this message. The result feeds TypeORM `DataSourceOptions`.

Source

Thrown at packages/components/nodes/vectorstores/Postgres/driver/TypeORM.ts:29

type TypeORMAddDocumentOptions = {
    ids?: string[]
}

export class TypeORMDriver extends VectorStoreDriver {
    protected _postgresConnectionOptions: DataSourceOptions

    protected async getPostgresConnectionOptions() {
        if (!this._postgresConnectionOptions) {
            const { user, password } = await this.getCredentials()
            const additionalConfig = this.nodeData.inputs?.additionalConfig as string

            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)
            }

            this._postgresConnectionOptions = {
                ...additionalConfiguration,
                type: 'postgres',
                host: this.getHost(),
                port: this.getPort(),
                ssl: this.getSSL(),
                username: user, // Required by TypeORMVectorStore
                user: user, // Required by Pool in similaritySearchVectorWithScore
                password: password,
                database: this.getDatabase()
            } as DataSourceOptions

            // Prevent using default MySQL port, otherwise will throw uncaught error and crashing the app
            if (this.getHost() === '3006') {

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Validate the value with a JSON linter before saving.
  2. Use strict JSON (double quotes, no trailing commas, no comments).
  3. Leave the field empty if unused.
  4. Pass an object programmatically to bypass JSON.parse.

Example fix

// before — invalid
"{ schema: 'public', }"
// after — valid
{"schema":"public"}
Defensive patterns

Strategy: validation

Validate before calling

function parseAdditionalConfig(raw: unknown): Record<string, unknown> {
  if (raw === undefined || raw === null || raw === '') return {}
  if (typeof raw === 'object') return raw as Record<string, unknown>
  try {
    return JSON.parse(raw)
  } catch {
    throw new Error('additionalConfig is not valid JSON')
  }
}

Type guard

function isJsonString(v: string): boolean {
  try { JSON.parse(v); return true } catch { return false }
}

Try / catch

const additionalConfiguration = parseAdditionalConfig(additionalConfig)

Prevention

When it happens

Trigger: Malformed JSON in the Additional Configuration field (trailing commas, single quotes, unquoted keys, comments). The TypeORM driver additionally requires the parsed object to be compatible with `DataSourceOptions`.

Common situations: Hand-edited JSON with JS-object syntax; copy-paste from TypeScript config with comments; stale template tokens; rich-text invisible characters.

Understand the failure class

Related errors


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