FlowiseAI/Flowise · error · Error

Invalid JSON in the BaseOptions: ${exception}

Error message

Invalid JSON in the BaseOptions: ${exception}

What it means

The Deepseek chat node inlines its BaseOptions parsing inside the try block (rather than pre-parsing into a variable). When the BaseOptions string fails JSON.parse, the SyntaxError is caught and re-thrown with the generic 'Invalid JSON in the BaseOptions' label. The parsed value feeds defaultHeaders under obj.configuration, then ChatDeepSeek is constructed.

Source

Thrown at packages/components/nodes/chatmodels/Deepseek/Deepseek.ts:194

        if (stopSequence) {
            const stopSequenceArray = stopSequence.split(',').map((item) => item.trim())
            obj.stop = stopSequenceArray
        }
        if (thinking) {
            obj.modelKwargs = {
                ...obj.modelKwargs,
                thinking: { type: 'enabled' }
            }
        }

        if (baseOptions) {
            try {
                const parsedBaseOptions = typeof baseOptions === 'object' ? baseOptions : JSON.parse(baseOptions)
                obj.configuration = {
                    defaultHeaders: parsedBaseOptions
                }
            } catch (exception) {
                throw new Error('Invalid JSON in the BaseOptions: ' + exception)
            }
        }

        const model = new ChatDeepSeek(obj)
        return model
    }
}

module.exports = { nodeClass: Deepseek_ChatModels }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. JSON-lint the BaseOptions value before saving.
  2. Use canonical JSON: double-quoted keys/values, no trailing commas, no comments.
  3. Pass an object input when constructing programmatically (the typeof === 'object' branch avoids parsing).
  4. If you only need a custom base URL, use basePath instead of baseOptions.

Example fix

// before
{ baseURL: "https://ds.proxy", } // unquoted key + trailing comma -> throws [98]

// after
{ "baseURL": "https://ds.proxy" }
Defensive patterns

Strategy: validation

Validate before calling

function parseBaseOptions(raw) {
  if (!raw) return undefined
  if (typeof raw === 'object') return raw
  try { return JSON.parse(raw) }
  catch (e) { throw new Error(`Deepseek BaseOptions JSON invalid: ${e.message}`) }
}
const parsedBaseOptions = parseBaseOptions(nodeData.inputs?.baseOptions)
if (parsedBaseOptions) obj.configuration = { defaultHeaders: parsedBaseOptions }

Type guard

function isHeadersObject(v: unknown): v is Record<string, string> {
  if (typeof v !== 'object' || v === null || Array.isArray(v)) return false
  return Object.values(v).every(x => typeof x === 'string')
}

Try / catch

try {
  return await initDeepseek(nodeData, options)
} catch (e) {
  if (e.message.includes('Invalid JSON in the BaseOptions')) {
    throw new Error('Correct BaseOptions JSON on the Deepseek node (or use basePath for a custom URL).')
  }
  throw e
}

Prevention

When it happens

Trigger: The Deepseek node's BaseOptions field holds malformed JSON; reached only when baseOptions is truthy. Unlike the sibling nodes, this parser also writes obj.configuration inside the same try, so a parse failure aborts the whole configuration build.

Common situations: Users configuring custom headers for a DeepSeek-compatible proxy paste invalid JSON; trailing commas; unquoted keys; smart quotes from docs; confusion between the baseOptions field and the basePath field.

Understand the failure class

Related errors


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