invoke-ai/InvokeAI · error · UnknownMetadataException
'{url}' does not look like a HuggingFace model page
Error message
'{url}' does not look like a HuggingFace model page What it means
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.
Source
Thrown at invokeai/backend/model_manager/metadata/fetch/huggingface.py:168
id=model_info.id,
name=name,
files=files,
api_response=json.dumps(model_info.__dict__, default=str),
is_diffusers=is_diffusers,
ckpt_urls=ckpt_urls,
)
def from_url(self, url: AnyHttpUrl) -> AnyModelRepoMetadata:
"""
Return a HuggingFaceMetadata object given the model's web page URL.
In the case of an invalid or missing URL, raises a ModelNotFound exception.
"""
if match := re.match(HF_MODEL_RE, str(url), re.IGNORECASE):
repo_id = match.group(1)
return self.from_id(repo_id)
else:
raise UnknownMetadataException(f"'{url}' does not look like a HuggingFace model page")
View on GitHub (pinned to 0b6a024f2f)
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.
Example fix
// before
meta = fetcher.from_url('https://huggingface.co/org/model/resolve/main/model.safetensors')
// after
meta = fetcher.from_url('https://huggingface.co/org/model') Defensive patterns
Strategy: validation
Validate before calling
import re
HF_MODEL_RE = r'https?://(?:www\.)?huggingface\.co/([\w\-.]+/[\w\-.]+)(?:$|[/?#])'
def is_hf_model_url(url: str) -> bool:
return re.match(HF_MODEL_RE, url, re.IGNORECASE) is not None Type guard
def is_hf_model_page_url(url: object) -> bool:
import re
return isinstance(url, str) and re.match(
r'https?://(?:www\.)?huggingface\.co/[\w\-.]+/[\w\-.]+(?:$|[/?#])',
url, re.IGNORECASE) is not None Try / catch
try:
meta = fetcher.from_url(url)
except UnknownMetadataException:
# URL not a HF model page; prompt user or try from_id on a manually-extracted repo id
raise ValueError(f'{url} is not a huggingface.co/<org>/<repo> model page') Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- {source}: No downloadable files found
- Video reports invalid dimensions {width}x{height}
- Video at {video_path} reports an invalid duration {duration}
- No external provider config fields provided
- str(e)
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/222e6cc5680ee884.
Report an issue: GitHub.