FlowiseAI/Flowise · warning · Error
Model file does not exist or is empty
Error message
Model file does not exist or is empty
What it means
Thrown by getRawModelFile() when MODEL_LIST_CONFIG_JSON is neither a valid URL nor an existing file path, or is a file path that exists but is empty. This is the fall-through throw at line 53 reached when isValidUrl() is false AND fs.existsSync() is false (or the file is empty after read). Like error 597, it is caught by the same try/catch (line 54) which then falls back to the bundled models.json.
Source
Thrown at packages/components/src/modelLoader.ts:53
*/
const getRawModelFile = async () => {
const modelFile =
process.env.MODEL_LIST_CONFIG_JSON ?? 'https://raw.githubusercontent.com/FlowiseAI/Flowise/main/packages/components/models.json'
try {
if (isValidUrl(modelFile)) {
const resp = await axios.get(modelFile)
if (resp.status === 200 && resp.data) {
return resp.data
} else {
throw new Error('Error fetching model list')
}
} else if (fs.existsSync(modelFile)) {
const models = await fs.promises.readFile(modelFile, 'utf8')
if (models) {
return JSON.parse(models)
}
}
throw new Error('Model file does not exist or is empty')
} catch (e) {
const models = await fs.promises.readFile(getModelsJSONPath(), 'utf8')
if (models) {
return JSON.parse(models)
}
return {}
}
}
const getModelConfig = async (category: MODEL_TYPE, name: string) => {
const models = await getRawModelFile()
const categoryModels = models[category]
return categoryModels.find((model: INodeOptionsValue) => model.name === name)
}
export const getModelConfigByModelName = async (category: MODEL_TYPE, provider: string | undefined, name: string | undefined) => {
const models = await getRawModelFile()View on GitHub (pinned to abe4a8601a)
Solutions
- Point MODEL_LIST_CONFIG_JSON at an existing, non-empty JSON file with an absolute path.
- If you want the URL source, ensure the value starts with http:// or https:// so isValidUrl returns true.
- Unset MODEL_LIST_CONFIG_JSON to use the default GitHub raw URL (and its disk fallback).
- Ensure the bundled models.json (returned by getModelsJSONPath()) exists so the fallback in the catch succeeds.
Example fix
# before export MODEL_LIST_CONFIG_JSON='./config/models.json' # missing or empty # after export MODEL_LIST_CONFIG_JSON='/opt/app/config/models.json' # absolute, exists, non-empty # or simply unset MODEL_LIST_CONFIG_JSON # use default URL + bundled fallback
Defensive patterns
Strategy: fallback
Validate before calling
import fs from 'fs'
function validateModelListConfig(value: string | undefined): { ok: boolean; reason?: string } {
if (!value) return { ok: true } // uses default
if (/^https?:\/\//.test(value)) return { ok: true } // URL path
if (fs.existsSync(value)) {
const stat = fs.statSync(value)
if (stat.size > 0) return { ok: true }
return { ok: false, reason: `${value} is empty` }
}
return { ok: false, reason: `${value} does not exist and is not a URL` }
}
const check = validateModelListConfig(process.env.MODEL_LIST_CONFIG_JSON)
if (!check.ok) console.warn(`MODEL_LIST_CONFIG_JSON: ${check.reason}`) Try / catch
// The internal fallback handles this; wrap getModels to degrade gracefully
try {
return await getModels(category, name)
} catch (e) {
if (String(e).startsWith('Error: getModels')) return []
throw e
} Prevention
- Use absolute paths for local model-list files.
- Ensure the file is non-empty and valid JSON.
- Keep the bundled models.json intact as the final fallback.
When it happens
Trigger: MODEL_LIST_CONFIG_JSON is set to a non-URL, non-existent path (e.g. './config/models.json' when the file isn't there), or to a path whose file is empty. isValidUrl() returns false, the fs.existsSync branch is skipped (or the file is empty), and line 53 throws. The catch falls back to getModelsJSONPath().
Common situations: Typo in the env var path. Relative path resolved against the wrong working directory. File deleted or not mounted in a container. An empty file left by a failed config render. The env var set to a bare hostname without protocol (isValidUrl returns false because protocol isn't http/https).
Related errors
- Error fetching model list
- Error: getModels - ${e}
- Invalid path: path must be within allowed directories (${all
- Invalid SQLite path: path must be within allowed directories
- Model is required
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/5d388258918e89b1.
Report an issue: GitHub.