{"record":{"id":"d068aea724a91262","repo":"FlowiseAI/Flowise","slug":"error-getregions-e","errorCode":null,"errorMessage":"Error: getRegions - ${e}","messagePattern":"Error: getRegions - (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/src/modelLoader.ts","lineNumber":108,"sourceCode":"export const getModels = async (category: MODEL_TYPE, name: string) => {\n    const returnData: INodeOptionsValue[] = []\n    try {\n        const modelConfig = await getModelConfig(category, name)\n        returnData.push(...modelConfig.models)\n        return returnData\n    } catch (e) {\n        throw new Error(`Error: getModels - ${e}`)\n    }\n}\n\nexport const getRegions = async (category: MODEL_TYPE, name: string) => {\n    const returnData: INodeOptionsValue[] = []\n    try {\n        const modelConfig = await getModelConfig(category, name)\n        returnData.push(...modelConfig.regions)\n        return returnData\n    } catch (e) {\n        throw new Error(`Error: getRegions - ${e}`)\n    }\n}\n","sourceCodeStart":90,"sourceCodeEnd":111,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/src/modelLoader.ts#L90-L111","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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).","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).","Ensure the provider entry actually has a non-null 'regions' array before calling getRegions.","If offline, ship a local models.json and point MODEL_LIST_CONFIG_JSON at it."],"exampleFix":"// before: provider name typo / missing regions\nawait getRegions(MODEL_TYPE.CHAT, 'bedrock') // throws if 'bedrock' absent or has no regions\n\n// after: guard the lookup, fall back gracefully\nconst cfg = await getModelConfigByModelName(MODEL_TYPE.CHAT, 'bedrock', undefined)\nif (!cfg || !Array.isArray(cfg.regions)) return []\nreturn cfg.regions","handlingStrategy":"try-catch","validationCode":"import { getModelConfigByModelName, MODEL_TYPE } from './modelLoader'\n\nasync function safeGetRegions(category: MODEL_TYPE, provider: string) {\n  const cfg = await getModelConfigByModelName(category, provider, undefined)\n  if (!cfg || !Array.isArray((cfg as any).regions)) return []\n  return (cfg as any).regions\n}","typeGuard":"const hasRegions = (cfg: unknown): cfg is { regions: unknown[] } =>\n  !!cfg && typeof cfg === 'object' && Array.isArray((cfg as any).regions)","tryCatchPattern":"try {\n  const regions = await getRegions(category, name)\n} catch (e) {\n  // suffix after 'Error: getRegions - ' holds the real cause\n  const cause = (e as Error).message.replace(/^Error: getRegions - /, '')\n  logger.warn(`getRegions failed for ${name}: ${cause}`)\n  return []\n}","preventionTips":["Validate the provider name against the loaded registry before calling getRegions.","Always treat the model list as possibly-missing and provide a default empty regions list.","Pin MODEL_LIST_CONFIG_JSON to a version-controlled local file in production for deterministic lookups."],"tags":["model-loader","config","async","flowise"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}