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
- JSON-lint the BaseOptions value before saving.
- Use canonical JSON: double-quoted keys/values, no trailing commas, no comments.
- Pass an object input when constructing programmatically (the typeof === 'object' branch avoids parsing).
- 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
- JSON-lint BaseOptions before saving.
- Use basePath (not baseOptions) for a custom base URL.
- Pass object inputs when constructing programmatically.
- Validate JSON in the UI before the request reaches the try block.
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
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Invalid JSON in the ChatOpenAI's BaseOptions: ${exception}
- Invalid JSON in the ChatOpenAI's BaseOptions: ${exception}
- Invalid JSON in the ChatOpenRouter's BaseOptions: ${exceptio
- Invalid JSON in the ChatSambanova's BaseOptions: ${exception
- Invalid JSON in the Chat NVIDIA NIM's baseOptions: ${excepti
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/2e3fc419bf394595.
Report an issue: GitHub.