FlowiseAI/Flowise · error · Error
Error: getModels - ${e}
Error message
Error: getModels - ${e} What it means
Thrown by getModels() as a catch-all wrapper around getModelConfig() and the subsequent modelConfig.models access. Any error — most commonly modelConfig being undefined because no model in the category matches the given name, leading to a 'cannot read properties of undefined (reading models)' TypeError — is caught at line 96 and re-thrown with this prefix. The same pattern is used by getRegions() for the regions field.
Source
Thrown at packages/components/src/modelLoader.ts:97
if (cm.models && cm.name.toLowerCase() === provider?.toLowerCase()) {
for (const m of cm.models) {
if (m.name === name) {
return m
}
}
}
}
return undefined
}
export const getModels = async (category: MODEL_TYPE, name: string) => {
const returnData: INodeOptionsValue[] = []
try {
const modelConfig = await getModelConfig(category, name)
returnData.push(...modelConfig.models)
return returnData
} catch (e) {
throw new Error(`Error: getModels - ${e}`)
}
}
export const getRegions = async (category: MODEL_TYPE, name: string) => {
const returnData: INodeOptionsValue[] = []
try {
const modelConfig = await getModelConfig(category, name)
returnData.push(...modelConfig.regions)
return returnData
} catch (e) {
throw new Error(`Error: getRegions - ${e}`)
}
}
View on GitHub (pinned to abe4a8601a)
Solutions
- Verify the (category, name) pair exists in the models file: inspect the JSON or getModelConfig output directly.
- If the models file failed to load, fix the root cause per errors 597/598 (URL reachability or local file presence).
- Update the name argument to match a model that exists in the current models.json.
- Wrap getModels() in a try/catch at the call site and degrade gracefully (empty list) for UI consumers.
Example fix
// before
const models = await getModels(MODEL_TYPE.LLM, 'nonexistentModel') // throws
// after
// 1. confirm the model name exists in models.json first
const config = await getModelConfig(MODEL_TYPE.LLM, 'gpt-4')
if (!config) throw new Error('Model not found in catalog')
const models = await getModels(MODEL_TYPE.LLM, 'gpt-4')
// 2. or guard the call site
let models: INodeOptionsValue[] = []
try { models = await getModels(category, name) }
catch (e) { console.warn(`No models for ${category}/${name}`, e) } Defensive patterns
Strategy: validation
Validate before calling
import { getModelConfig, MODEL_TYPE } from './modelLoader'
async function getModelsSafe(category: MODEL_TYPE, name: string) {
const config = await getModelConfig(category, name)
if (!config) {
throw new Error(`No model config for ${category}/${name}; check models.json`)
}
return config.models ?? []
}
const models = await getModelsSafe(MODEL_TYPE.LLM, 'gpt-4') Try / catch
let models: INodeOptionsValue[] = []
try {
models = await getModels(category, name)
} catch (e) {
console.warn(`getModels failed for ${category}/${name}:`, e)
models = [] // degrade gracefully in UI
} Prevention
- Validate the (category, name) pair against the models catalog before calling getModels.
- Degrade to an empty list in UI consumers rather than crashing.
- Keep the models file current with the model names the application expects.
When it happens
Trigger: Calling getModels(category, name) where (category, name) does not match any entry in the loaded models file. getModelConfig() returns undefined, then returnData.push(...modelConfig.models) throws a TypeError on undefined.models, which is caught and wrapped. Also fires if getRawModelFile() itself fails (e.g. both URL and disk fallback failed, returning {}).
Common situations: Requesting a model name that doesn't exist in models.json (typo, removed in a newer version, wrong category). The models file failed to load entirely (network + disk fallback both empty → {} → models[category] is undefined). A version mismatch between the code's expected model names and the configured models file.
Related errors
- Model is required
- Model is required
- Scenarios are required
- Invalid JSON in executeFlowOverrideConfig: ${parseError.mess
- Invalid base URL: must be a valid URL
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/d558fca696677369.
Report an issue: GitHub.