{"record":{"id":"bea81901fd285312","repo":"remotion-dev/remotion","slug":"unsupported-video-matting-model-model-availa","errorCode":null,"errorMessage":"Unsupported video matting model \"${model}\". Available models: ${VIDEO_MATTING_MODELS.join(', ')}.","messagePattern":"Unsupported video matting model \"(.+?)\"\\. Available models: (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/video-matting/src/models.ts","lineNumber":60,"sourceCode":"};\n\nexport const getAvailableModels = (): VideoMattingModelInfo[] => {\n\treturn VIDEO_MATTING_MODELS.map((model) => {\n\t\tconst {\n\t\t\trevision: _revision,\n\t\t\tdtype: _dtype,\n\t\t\trequiresShaderF16: _requiresShaderF16,\n\t\t\t...info\n\t\t} = MODEL_INFO[model];\n\t\treturn {...info};\n\t});\n};\n\nexport const getVideoMattingModelInfo = (\n\tmodel: VideoMattingModel,\n): InternalVideoMattingModelInfo => {\n\tif (!Object.hasOwn(MODEL_INFO, model)) {\n\t\tthrow new Error(\n\t\t\t`Unsupported video matting model \"${model}\". Available models: ${VIDEO_MATTING_MODELS.join(', ')}.`,\n\t\t);\n\t}\n\n\treturn MODEL_INFO[model];\n};\n\nexport const getHostedVideoMattingModelId = (\n\tmodel: VideoMattingModel,\n): string => {\n\treturn HOSTED_MODEL_IDS[model];\n};\n","sourceCodeStart":42,"sourceCodeEnd":73,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/video-matting/src/models.ts#L42-L73","documentation":"getVideoMattingModelInfo is a lookup guard: when asked for a model key not present in the MODEL_INFO registry, it throws listing the supported models from VIDEO_MATTING_MODELS. Callers pass an invalid VideoMattingModel string, often a typo or a model name not shipped in the installed package version.","triggerScenarios":"Calling getVideoMattingModelInfo('my-model') or passing model to matting APIs with a value outside the VIDEO_MATTING_MODELS union (often a string that bypassed TypeScript typing via `as` or plain JS).","commonSituations":"Typo in model name; upgrading Remotion added/renamed models while old code uses a removed id; stringly-typed config from a database or CLI where the union type is not enforced.","solutions":["Pick a model from the list printed in the error message","Update to a currently supported model id if yours was removed in an upgrade","Validate user/config-supplied model names against VIDEO_MATTING_MODELS before calling"],"exampleFix":"// before\nconst model = 'modnet-large' as VideoMattingModel;\n// after\nconst model: VideoMattingModel = 'Xenova/modnet';","handlingStrategy":"type-guard","validationCode":"if (!(VIDEO_MATTING_MODELS as readonly string[]).includes(model)) {\n  model = 'Xenova/modnet'; // default\n}\n","typeGuard":"const isVideoMattingModel = (m: string): m is VideoMattingModel =>\n  (VIDEO_MATTING_MODELS as readonly string[]).includes(m);\n","tryCatchPattern":"try {\n  const info = getVideoMattingModelInfo(model);\n} catch (e) {\n  if ((e as Error).message.startsWith('Unsupported video matting model')) {\n    // use default model\n  }\n  throw e;\n}\n","preventionTips":["Type user input as VideoMattingModel at the boundary","Validate model names coming from config/CLI against the union","Re-check model ids after upgrading Remotion"],"tags":["model","validation","invalid-value"],"backgroundTag":"invalid-enum-value","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-09-09T13:27:51.281Z","contentChangedAt":"2026-09-09T13:27:51.281Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}