FlowiseAI/Flowise · error · Error
Invalid JSON in the OpenAIEmbedding's BaseOptions:
Error message
Invalid JSON in the OpenAIEmbedding's BaseOptions:
What it means
The OpenAIEmbedding node only calls JSON.parse(baseOptions) when baseOptions is a non-object value; a thrown SyntaxError is caught and re-thrown with this prefix. Object inputs bypass parsing entirely.
Source
Thrown at packages/components/nodes/embeddings/OpenAIEmbedding/OpenAIEmbedding.ts:145
const obj: Partial<OpenAIEmbeddingsParams> & { openAIApiKey?: string; configuration?: ClientOptions } = {
openAIApiKey,
modelName
}
if (stripNewLines) obj.stripNewLines = stripNewLines
if (batchSize) obj.batchSize = parseInt(batchSize, 10)
if (timeout) obj.timeout = parseInt(timeout, 10)
if (dimensions) obj.dimensions = parseInt(dimensions, 10)
if (encodingFormat) obj.encodingFormat = encodingFormat
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 OpenAIEmbedding's BaseOptions: " + exception)
}
}
if (basePath || parsedBaseOptions) {
obj.configuration = {
baseURL: basePath,
defaultHeaders: parsedBaseOptions
}
}
const model = new OpenAIEmbeddings(obj)
return model
}
}
module.exports = { nodeClass: OpenAIEmbedding_Embeddings }
View on GitHub (pinned to abe4a8601a)
Solutions
- Validate the baseOptions field as JSON in the node UI before saving.
- Pass baseOptions as a JS object rather than a string so the parse branch is skipped.
- Run the value through a JSON linter (jsonlint.com / jq) to locate the syntax error.
Example fix
// before
{ model: 'text-embedding-3-small', temperature: 0 }
// after
{"model":"text-embedding-3-small"} Defensive patterns
Strategy: validation
Validate before calling
function parseBaseOptions(raw: unknown): Record<string, unknown> | undefined {
if (raw == null) return undefined
if (typeof raw === 'object') return raw as Record<string, unknown>
if (typeof raw === 'string') JSON.parse(raw) // throws early with a clear SyntaxError
return undefined
}
const parsedBaseOptions = parseBaseOptions(baseOptions) Type guard
function isJsonObjectString(v: string): v is string {
try { const o = JSON.parse(v); return typeof o === 'object' && o !== null } catch { return false }
} Try / catch
try {
parsedBaseOptions = typeof baseOptions === 'object' ? baseOptions : JSON.parse(baseOptions)
} catch (e) {
throw new Error(`BaseOptions is not valid JSON: ${(e as Error).message}`)
} Prevention
- Always quote keys and string values in the BaseOptions field.
- Prefer passing an object over a JSON string when the API allows it.
- Lint JSON configs in CI before deploy.
- Avoid pasting from word processors that convert quotes.
When it happens
Trigger: User enters free-form Additional Options in the Flowise node UI that are not valid JSON: trailing commas, single quotes, unquoted keys, or a stray JS object literal pasted verbatim.
Common situations: Copy-paste of a JS object literal instead of JSON; mismatched/curly quotes from a word processor; empty-ish string like '{}' with trailing characters; previous config that worked as an object now passed as a string.
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:
- Invalid JSON in the OpenAI's BaseOptions:
- Invalid JSON in the Chat NVIDIA NIM's baseOptions: ${excepti
- Invalid JSON in the ChatOpenAI's BaseOptions: ${exception}
- Invalid JSON in the Additional Configuration:
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/2e207c9bcc000833.
Report an issue: GitHub.