{"record":{"id":"11634ea1890cdf5e","repo":"FlowiseAI/Flowise","slug":"invalid-json-in-search-domain-filter-exception","errorCode":null,"errorMessage":"Invalid JSON in Search Domain Filter: ${exception}","messagePattern":"Invalid JSON in Search Domain Filter: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/chatmodels/ChatPerplexity/ChatPerplexity.ts","lineNumber":224,"sourceCode":"\n        if (temperature) obj.temperature = parseFloat(temperature)\n        if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)\n        if (topP) obj.topP = parseFloat(topP)\n        if (topK) obj.topK = parseInt(topK, 10)\n        if (presencePenalty) obj.presencePenalty = parseFloat(presencePenalty)\n        if (frequencyPenalty) obj.frequencyPenalty = parseFloat(frequencyPenalty)\n        if (timeout) obj.timeout = parseInt(timeout, 10)\n        if (returnImages) obj.returnImages = returnImages\n        if (returnRelatedQuestions) obj.returnRelatedQuestions = returnRelatedQuestions\n        if (searchRecencyFilter && searchRecencyFilter !== '') obj.searchRecencyFilter = searchRecencyFilter\n        if (cache) obj.cache = cache\n\n        if (searchDomainFilterRaw) {\n            try {\n                obj.searchDomainFilter =\n                    typeof searchDomainFilterRaw === 'object' ? searchDomainFilterRaw : JSON.parse(searchDomainFilterRaw)\n            } catch (exception) {\n                throw new Error('Invalid JSON in Search Domain Filter: ' + exception)\n            }\n        }\n\n        if (proxyUrl) {\n            console.warn('Proxy configuration for ChatPerplexity might require adjustments to FlowiseChatPerplexity wrapper.')\n        }\n\n        const perplexityModel = new ChatPerplexity(nodeData.id, obj)\n        return perplexityModel\n    }\n}\n\nmodule.exports = { nodeClass: ChatPerplexity_ChatModels }\n","sourceCodeStart":206,"sourceCodeEnd":238,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/chatmodels/ChatPerplexity/ChatPerplexity.ts#L206-L238","documentation":"ChatPerplexity parses searchDomainFilterRaw: if it is a string it is JSON.parse'd into obj.searchDomainFilter (an array of domains); any SyntaxError is re-thrown with this label. Object inputs bypass parsing. This field maps to Perplexity's search_domain_filter API parameter.","triggerScenarios":"The Search Domain Filter input holds a malformed JSON array — e.g. a comma-separated string 'a.com,b.com' instead of [\"a.com\",\"b.com\"], or an array with unquoted/trailing-comma entries. Reached only when searchDomainFilterRaw is a truthy string.","commonSituations":"Users type a comma-separated list instead of a JSON array; paste domains with surrounding quotes mismatched; leave a trailing comma; copy from docs that mangle quotes; confuse the filter (an array) with a single domain string.","solutions":["Provide a JSON array of domains: [\"example.com\",\"site.org\"] — no trailing comma, double quotes.","If you only want one domain, use [\"example.com\"] not a bare string.","JSON-lint the value before saving; validate it is an array of strings.","When constructing programmatically, pass a real array to skip parsing."],"exampleFix":"// before\nsearchDomainFilterRaw = 'example.com, site.org' // not JSON -> throws [96]\n\n// after\nsearchDomainFilterRaw = '[\"example.com\", \"site.org\"]'","handlingStrategy":"validation","validationCode":"function parseSearchDomainFilter(raw) {\n  if (!raw) return undefined\n  if (Array.isArray(raw)) return raw\n  try {\n    const parsed = JSON.parse(raw)\n    if (!Array.isArray(parsed)) throw new Error('searchDomainFilter must be a JSON array of strings')\n    return parsed\n  } catch (e) {\n    throw new Error(`Search Domain Filter must be a JSON array like [\"a.com\"]: ${e.message}`)\n  }\n}\nobj.searchDomainFilter = parseSearchDomainFilter(searchDomainFilterRaw)","typeGuard":"function isDomainArray(v: unknown): v is string[] {\n  return Array.isArray(v) && v.every(x => typeof x === 'string')\n}","tryCatchPattern":"try {\n  return await initChatPerplexity(nodeData, options)\n} catch (e) {\n  if (e.message.includes('Invalid JSON in Search Domain Filter')) {\n    throw new Error('Set Search Domain Filter to a JSON array, e.g. [\"example.com\"].')\n  }\n  throw e\n}","preventionTips":["Always use a JSON array [\"domain.com\"] for Search Domain Filter.","Never use a bare comma-separated string.","JSON-lint the value before saving.","Pass a real array when constructing programmatically."],"tags":["json","perplexity","validation","configuration","search-filter"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}