FlowiseAI/Flowise · error · Error

Error: getRegions - ${e}

Error message

Error: getRegions - ${e}

What it means

getRegions(category, name) loads the model registry (from MODEL_LIST_CONFIG_JSON URL, env-overridable, else bundled models.json), finds the provider config under models[category] by name, and spreads its .regions array. Any failure is caught and rethrown wrapped as 'Error: getRegions - <cause>'. The most common inner cause is a TypeError: getModelConfig returns undefined when the provider name is unknown, so modelConfig.regions throws 'Cannot read properties of undefined (reading regions)'. Network/parse failures from getRawModelFile are also wrapped here.

Source

Thrown at packages/components/src/modelLoader.ts:108

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

  1. Read the suffix after 'getRegions - ' to get the real cause (e.g. 'Cannot read properties of undefined (reading regions)' means the provider name was not found).
  2. Verify the provider name exists under the correct category in the active models.json (check process.env.MODEL_LIST_CONFIG_JSON, or unset it to use the bundled file).
  3. Ensure the provider entry actually has a non-null 'regions' array before calling getRegions.
  4. If offline, ship a local models.json and point MODEL_LIST_CONFIG_JSON at it.

Example fix

// before: provider name typo / missing regions
await getRegions(MODEL_TYPE.CHAT, 'bedrock') // throws if 'bedrock' absent or has no regions

// after: guard the lookup, fall back gracefully
const cfg = await getModelConfigByModelName(MODEL_TYPE.CHAT, 'bedrock', undefined)
if (!cfg || !Array.isArray(cfg.regions)) return []
return cfg.regions
Defensive patterns

Strategy: try-catch

Validate before calling

import { getModelConfigByModelName, MODEL_TYPE } from './modelLoader'

async function safeGetRegions(category: MODEL_TYPE, provider: string) {
  const cfg = await getModelConfigByModelName(category, provider, undefined)
  if (!cfg || !Array.isArray((cfg as any).regions)) return []
  return (cfg as any).regions
}

Type guard

const hasRegions = (cfg: unknown): cfg is { regions: unknown[] } =>
  !!cfg && typeof cfg === 'object' && Array.isArray((cfg as any).regions)

Try / catch

try {
  const regions = await getRegions(category, name)
} catch (e) {
  // suffix after 'Error: getRegions - ' holds the real cause
  const cause = (e as Error).message.replace(/^Error: getRegions - /, '')
  logger.warn(`getRegions failed for ${name}: ${cause}`)
  return []
}

Prevention

When it happens

Trigger: Calling getRegions(MODEL_TYPE.CHAT, 'nonexistent') where no provider matches; MODEL_LIST_CONFIG_JSON points at an unreachable URL and the bundled fallback file is missing/malformed; the located provider object has no 'regions' field; the registry's category array is missing so models[category].find throws.

Common situations: Provider renamed or removed upstream in models.json; typo in the provider name passed from a node's loadMethods; offline/air-gapped dev where raw.githubusercontent.com is blocked; stale custom MODEL_LIST_CONFIG_JSON after a Flowise upgrade that changed the schema.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/d068aea724a91262. Report an issue: GitHub.