{"record":{"id":"222e6cc5680ee884","repo":"invoke-ai/InvokeAI","slug":"url-does-not-look-like-a-huggingface-model-pag","errorCode":null,"errorMessage":"'{url}' does not look like a HuggingFace model page","messagePattern":"'(.+?)' does not look like a HuggingFace model page","errorType":"exception","errorClass":"UnknownMetadataException","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/metadata/fetch/huggingface.py","lineNumber":168,"sourceCode":"            id=model_info.id,\n            name=name,\n            files=files,\n            api_response=json.dumps(model_info.__dict__, default=str),\n            is_diffusers=is_diffusers,\n            ckpt_urls=ckpt_urls,\n        )\n\n    def from_url(self, url: AnyHttpUrl) -> AnyModelRepoMetadata:\n        \"\"\"\n        Return a HuggingFaceMetadata object given the model's web page URL.\n\n        In the case of an invalid or missing URL, raises a ModelNotFound exception.\n        \"\"\"\n        if match := re.match(HF_MODEL_RE, str(url), re.IGNORECASE):\n            repo_id = match.group(1)\n            return self.from_id(repo_id)\n        else:\n            raise UnknownMetadataException(f\"'{url}' does not look like a HuggingFace model page\")\n","sourceCodeStart":150,"sourceCodeEnd":169,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/metadata/fetch/huggingface.py#L150-L169","documentation":"from_url parses an HF model page URL with HF_MODEL_RE to extract the org/repo id. If the URL doesn't match the expected huggingface.co/<org>/<repo> pattern, it raises UnknownMetadataException because no repo id can be derived. This is the public entry point used when importing a model by URL.","triggerScenarios":"Calling from_url with a non-HF URL ( Civitai, direct file links like .../resolve/main/model.safetensors, repo trees, pull requests, discussions URLs), a URL missing the org/repo path, or a typo/whitespace in the URL string.","commonSituations":"Pasting a direct-file download link instead of the model page; passing a mirror or hf-mirror.com domain; URLs with extra segments (blob/tree/resolve); users submitting Civitai links to an HF fetcher.","solutions":["Pass the plain model page URL: https://huggingface.co/<org>/<repo> (no /blob/, /tree/, /resolve/, or file names).","If you have a direct file URL, strip everything after the repo id, or use from_id('<org>/<repo>') instead.","Confirm the host is huggingface.co (or www.huggingface.co) — mirrors won't match HF_MODEL_RE.","Validate the URL with the same regex before calling to give users better feedback."],"exampleFix":"// before\nmeta = fetcher.from_url('https://huggingface.co/org/model/resolve/main/model.safetensors')\n// after\nmeta = fetcher.from_url('https://huggingface.co/org/model')","handlingStrategy":"validation","validationCode":"import re\nHF_MODEL_RE = r'https?://(?:www\\.)?huggingface\\.co/([\\w\\-.]+/[\\w\\-.]+)(?:$|[/?#])'\ndef is_hf_model_url(url: str) -> bool:\n    return re.match(HF_MODEL_RE, url, re.IGNORECASE) is not None","typeGuard":"def is_hf_model_page_url(url: object) -> bool:\n    import re\n    return isinstance(url, str) and re.match(\n        r'https?://(?:www\\.)?huggingface\\.co/[\\w\\-.]+/[\\w\\-.]+(?:$|[/?#])',\n        url, re.IGNORECASE) is not None","tryCatchPattern":"try:\n    meta = fetcher.from_url(url)\nexcept UnknownMetadataException:\n    # URL not a HF model page; prompt user or try from_id on a manually-extracted repo id\n    raise ValueError(f'{url} is not a huggingface.co/<org>/<repo> model page')","preventionTips":["Accept only huggingface.co/<org>/<repo> page URLs, not /resolve/, /blob/ or file links","Strip file paths and query strings from pasted URLs before calling from_url","Route Civitai or mirror URLs to their own fetchers instead of the HF fetcher","Prefer from_id('org/repo') when the repo id is already known"],"tags":["url-parsing","huggingface","validation","metadata"],"backgroundTag":"invalid-model-url-format","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}