{"record":{"id":"1df7c6fe5340e4a1","repo":"FlowiseAI/Flowise","slug":"error-fetching-model-list","errorCode":null,"errorMessage":"Error fetching model list","messagePattern":"Error fetching model list","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/components/src/modelLoader.ts","lineNumber":45,"sourceCode":"        return false\n    }\n    return url.protocol === 'http:' || url.protocol === 'https:'\n}\n\n/**\n * Load the raw model file from either a URL or a local file\n * If any of the loading fails, fallback to the default models.json file on disk\n */\nconst getRawModelFile = async () => {\n    const modelFile =\n        process.env.MODEL_LIST_CONFIG_JSON ?? 'https://raw.githubusercontent.com/FlowiseAI/Flowise/main/packages/components/models.json'\n    try {\n        if (isValidUrl(modelFile)) {\n            const resp = await axios.get(modelFile)\n            if (resp.status === 200 && resp.data) {\n                return resp.data\n            } else {\n                throw new Error('Error fetching model list')\n            }\n        } else if (fs.existsSync(modelFile)) {\n            const models = await fs.promises.readFile(modelFile, 'utf8')\n            if (models) {\n                return JSON.parse(models)\n            }\n        }\n        throw new Error('Model file does not exist or is empty')\n    } catch (e) {\n        const models = await fs.promises.readFile(getModelsJSONPath(), 'utf8')\n        if (models) {\n            return JSON.parse(models)\n        }\n        return {}\n    }\n}\n\nconst getModelConfig = async (category: MODEL_TYPE, name: string) => {","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/src/modelLoader.ts#L27-L63","documentation":"Thrown by getRawModelFile() when the configured MODEL_LIST_CONFIG_JSON is a valid URL, the HTTP request completes, but the response status is not 200 or the data is empty. The model list is fetched to populate provider/model dropdowns; a non-200 (e.g. 404, 500, redirect) or empty body triggers this. The error is thrown inside a try block whose catch (line 54) falls back to the local models.json, so callers of getRawModelFile normally never see it.","triggerScenarios":"MODEL_LIST_CONFIG_JSON points at a URL that returns 404/500/302 (axios follows some redirects but a final non-200 hits line 45), or returns 200 with an empty body. The throw at line 45 is caught immediately at line 54 and the function falls back to reading models.json from disk.","commonSituations":"The default GitHub raw URL is unreachable (corporate proxy, GitHub outage, rate limit returning 429 treated as non-200). A custom MODEL_LIST_CONFIG_JSON URL was misconfigured (typo, wrong branch, moved file). The endpoint returns 200 but empty due to a server bug. Network egress blocked.","solutions":["Verify the URL is reachable from the runtime: curl -I the MODEL_LIST_CONFIG_JSON value.","If the URL is wrong, update MODEL_LIST_CONFIG_JSON to a correct one or unset it to use the default.","For offline/air-gapped deployments, set MODEL_LIST_CONFIG_JSON to a local file path instead of a URL (this takes the fs.existsSync branch).","Rely on the fallback: ensure the bundled models.json on disk is present and valid so the catch at line 54 succeeds."],"exampleFix":"# before\nexport MODEL_LIST_CONFIG_JSON='https://example.com/wrong-path/models.json'\n\n# after\n# option 1: fix the URL\nexport MODEL_LIST_CONFIG_JSON='https://raw.githubusercontent.com/FlowiseAI/Flowise/main/packages/components/models.json'\n# option 2: use a local file (skips HTTP entirely)\nexport MODEL_LIST_CONFIG_JSON='/opt/app/config/models.json'","handlingStrategy":"fallback","validationCode":"// Health-check the model-list URL at startup\nasync function checkModelListUrl(url: string): Promise<boolean> {\n  try {\n    const r = await fetch(url)\n    return r.status === 200 && (await r.text()).length > 0\n  } catch {\n    return false\n  }\n}\n\nif (!(await checkModelListUrl(process.env.MODEL_LIST_CONFIG_JSON ?? ''))) {\n  console.warn('Model list URL unreachable; relying on bundled fallback')\n}","typeGuard":null,"tryCatchPattern":"// getRawModelFile already falls back internally; guard getModels callers\ntry {\n  return await getModels(category, name)\n} catch (e) {\n  if (String(e).startsWith('Error: getModels')) return []\n  throw e\n}","preventionTips":["For air-gapped deployments, set MODEL_LIST_CONFIG_JSON to a local file path.","Ensure the bundled models.json is present and valid as a fallback.","Monitor reachability of the model-list URL from the runtime."],"tags":["configuration","network","models","fallback","http"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}