FlowiseAI/Flowise · error · Error
Invalid JSON in the ChatSambanova's BaseOptions: ${exception
Error message
Invalid JSON in the ChatSambanova's BaseOptions: ${exception} What it means
ChatSambanova wraps ChatOpenAI and parses its own BaseOptions field identically to the OpenAI-compatible siblings. A string that fails JSON.parse is re-thrown with this label; objects pass through into defaultHeaders under configuration.
Source
Thrown at packages/components/nodes/chatmodels/ChatSambanova/ChatSambanova.ts:109
const sambanovaApiKey = getCredentialParam('sambanovaApiKey', credentialData, nodeData)
const obj: ChatOpenAIFields = {
temperature: temperature ? parseFloat(temperature) : undefined,
model: modelName,
apiKey: sambanovaApiKey,
openAIApiKey: sambanovaApiKey,
streaming: streaming ?? true
}
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 ChatSambanova's BaseOptions: " + exception)
}
}
if (basePath || parsedBaseOptions) {
obj.configuration = {
baseURL: basePath,
defaultHeaders: parsedBaseOptions
}
}
const model = new ChatOpenAI(obj)
return model
}
}
module.exports = { nodeClass: ChatSambanova_ChatModels }
View on GitHub (pinned to abe4a8601a)
Solutions
- JSON-lint the BaseOptions value and correct syntax errors.
- Use double-quoted keys/values; remove trailing commas and comments.
- Pass an object input when constructing programmatically to bypass JSON.parse.
- Start from a minimal {"X-Header":"value"} and extend incrementally.
Example fix
// before
{ 'X-Trace': 'abc', } // single quotes + trailing comma -> throws [97]
// after
{ "X-Trace": "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(`ChatSambanova 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 initChatSambanova(nodeData, options)
} catch (e) {
if (e.message.includes("Invalid JSON in the ChatSambanova's BaseOptions")) {
throw new Error('Fix BaseOptions JSON on the ChatSambanova node.')
}
throw e
} Prevention
- JSON-lint BaseOptions before saving.
- Prefer object inputs when constructing programmatically.
- Do not put Authorization here; use the API key field.
- Add a UI-side JSON validator.
When it happens
Trigger: The ChatSambanova node's BaseOptions field holds malformed JSON; the failure surface is identical to [92]/[94]. Reached only when baseOptions is a truthy string.
Common situations: Users adding Sambanova-specific headers (e.g. for routing or tracing) paste Python-dict-style or single-quoted JSON; trailing commas from relaxed editors; smart quotes from chat clients; mixing Authorization into BaseOptions instead of using the API key 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 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/27c7355a3c71127b.
Report an issue: GitHub.