{"record":{"id":"fad04a4ba1dc161c","repo":"invoke-ai/InvokeAI","slug":"unknown-variant-variant","errorCode":null,"errorMessage":"Unknown variant: {variant}","messagePattern":"Unknown variant: (.+?)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/model_util.py","lineNumber":149,"sourceCode":"    if not variant:  # ModelRepoVariant.DEFAULT evaluates to empty string for compatability with HF\n        files = other_files\n    elif variant == \"fp16\":\n        files = fp16_files\n    elif variant == \"8bit\":\n        files = bit8_files\n    else:\n        raise NotImplementedError(f\"Unknown variant: {variant}\")","sourceCodeStart":null,"sourceCodeEnd":null,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/model_util.py#L149","documentation":"calc_model_size_by_fs estimates a diffusers-format model's on-disk size by selecting the weight-file set matching the requested variant. Only '' (default), 'fp16', and '8bit' are recognized; anything else raises NotImplementedError. This guards against silently computing size from the wrong weight files when a new HF repo variant is added.","triggerScenarios":"Calling calc_model_size_by_fs(model_path, subfolder, variant) with a variant string other than None/''/'fp16'/'8bit' — e.g. 'fp32', 'bf16', 'openvino', or a typo like 'fp-16'.","commonSituations":"Passing a ModelRepoVariant enum value that was mapped to a new HF revision name; custom code or older persisted configs storing 'fp32'; upstream HF repos publishing variants InvokeAI's size calculator doesn't know about.","solutions":["Use only None/'' , 'fp16', or '8bit' as the variant when calling calc_model_size_by_fs.","Check the string for typos or stray whitespace ('fp-16' vs 'fp16'); normalize/strip before calling.","If you truly have a new variant, extend the function to classify its file names (add a set like bit8_files) instead of passing it through.","Pass variant=None and let the function fall back to the default file set if you only need a rough size estimate."],"exampleFix":"// before\ncalc_model_size_by_fs(path, subfolder, variant='fp32')\n// after\ncalc_model_size_by_fs(path, subfolder, variant='fp16' if variant == 'fp32' else (variant or None))","handlingStrategy":"validation","validationCode":"ALLOWED_VARIANTS = {None, '', 'fp16', '8bit'}\nif variant not in ALLOWED_VARIANTS:\n    raise ValueError(f'Unsupported variant {variant!r}; expected one of fp16, 8bit, or None')\ncalc_model_size_by_fs(path, subfolder, variant)","typeGuard":"def is_supported_variant(v: object) -> bool:\n    return v is None or v in ('', 'fp16', '8bit')","tryCatchPattern":"try:\n    size = calc_model_size_by_fs(path, subfolder, variant)\nexcept NotImplementedError as e:\n    logger.warning(f'{e}; estimating from default file set')\n    size = calc_model_size_by_fs(path, subfolder, None)","preventionTips":["Only pass '', 'fp16', or '8bit' as variant strings to this API","Strip and normalize variant strings coming from saved configs","Map new HF revision names to a supported variant before calling","Handle NotImplementedError with a fallback to the default variant"],"tags":["model-loading","variant","not-implemented","size-estimation"],"backgroundTag":"unknown-variant-value","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}