FlowiseAI/Flowise · error · Error
Invalid JSON in the ChatOpenAI's BaseOptions: ${exception}
Error message
Invalid JSON in the ChatOpenAI's BaseOptions: ${exception} What it means
ChatOpenAICustom is a thin sibling of ChatOpenAI and reproduces the same BaseOptions JSON-parse guard. When the BaseOptions string fails JSON.parse, the SyntaxError is re-thrown with the ChatOpenAI's-label message. (Note: the label says 'ChatOpenAI' even though this node is ChatOpenAICustom — a copy-paste artifact, but the failure mode is identical.)
Source
Thrown at packages/components/nodes/chatmodels/ChatOpenAICustom/ChatOpenAICustom.ts:160
openAIApiKey,
apiKey: openAIApiKey,
streaming: streaming ?? true
}
if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)
if (topP) obj.topP = parseFloat(topP)
if (frequencyPenalty) obj.frequencyPenalty = parseFloat(frequencyPenalty)
if (presencePenalty) obj.presencePenalty = parseFloat(presencePenalty)
if (timeout) obj.timeout = parseInt(timeout, 10)
if (cache) obj.cache = cache
let parsedBaseOptions: any | undefined = undefined
if (baseOptions) {
try {
parsedBaseOptions = typeof baseOptions === 'object' ? baseOptions : JSON.parse(baseOptions)
} catch (exception) {
throw new Error("Invalid JSON in the ChatOpenAI's BaseOptions: " + exception)
}
}
if (basePath) await checkDenyList(basePath)
if (basePath || parsedBaseOptions) {
obj.configuration = {
baseURL: basePath,
defaultHeaders: parsedBaseOptions
}
}
const model = new ChatOpenAI(obj)
return model
}
}
module.exports = { nodeClass: ChatOpenAICustom_ChatModels }View on GitHub (pinned to abe4a8601a)
Solutions
- JSON-lint the BaseOptions string and save the corrected version.
- If the message says 'ChatOpenAI' but you are on ChatOpenAICustom, remember the label is shared — fix BaseOptions on the ChatOpenAICustom node specifically.
- Pass an object rather than a string when constructing programmatically to bypass parsing.
- Start from a minimal valid object and add headers one at a time.
Example fix
// before
{ "X-Key": 'abc', } // mixed quotes + trailing comma -> throws [93]
// after
{ "X-Key": "abc" } 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(`ChatOpenAICustom BaseOptions JSON invalid: ${e.message}`) }
}
const parsedBaseOptions = parseBaseOptions(nodeData.inputs?.baseOptions) 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 initChatOpenAICustom(nodeData, options)
} catch (e) {
// Note: error label says 'ChatOpenAI' even on the Custom node
if (e.message.includes("Invalid JSON in the ChatOpenAI's BaseOptions")) {
throw new Error('Fix BaseOptions JSON on the ChatOpenAICustom node (label is shared with ChatOpenAI).')
}
throw e
} Prevention
- Remember the error label is shared — fix BaseOptions on whichever node you are actually using.
- JSON-lint the value before saving.
- Use object inputs when constructing programmatically.
- Add a UI-side validator to catch this before save.
When it happens
Trigger: The ChatOpenAICustom node's BaseOptions field holds malformed JSON; same parser failures as [92]. Reachable only when baseOptions is a truthy string.
Common situations: Users pointing at a custom OpenAI-compatible endpoint paste a headers object with JSON syntax errors; confusion between the ChatOpenAI and ChatOpenAICustom nodes leads to fixing the wrong node; docs example copied with formatting artifacts.
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 ChatOpenRouter's BaseOptions: ${exceptio
- Invalid JSON in the ChatSambanova's BaseOptions: ${exception
- Invalid JSON in the 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/4fe2656f5d833f4f.
Report an issue: GitHub.