invoke-ai/InvokeAI · error · ValueError

Unsupported model source: '{url}'

Error message

Unsupported model source: '{url}'

What it means

get_fetcher_from_url selects the metadata fetcher class for a model source URL. InvokeAI has reduced supported sources to HuggingFace only, so any URL that does not match the https(s)://huggingface.co/<org>/<repo> pattern raises this ValueError. It is thrown during model install when resolving remote files from a source string.

Source

Thrown at invokeai/app/services/model_install/model_install_default.py:1609

    def _signal_job_cancelled(self, job: ModelInstallJob) -> None:
        self._logger.info(f"Model install canceled: {job.source}")
        if job._install_tmpdir is not None:
            self._delete_install_marker(job._install_tmpdir)
        if self._event_bus:
            self._event_bus.emit_model_install_cancelled(job)

    @staticmethod
    def get_fetcher_from_url(url: str) -> Type[ModelMetadataFetchBase]:
        """
        Return a metadata fetcher appropriate for provided url.

        This used to be more useful, but the number of supported model
        sources has been reduced to HuggingFace alone.
        """
        if re.match(r"^https?://huggingface.co/[^/]+/[^/]+$", url.lower()):
            return HuggingFaceMetadataFetch
        raise ValueError(f"Unsupported model source: '{url}'")

    @staticmethod
    def _normalize_huggingface_blob_url(url: AnyHttpUrl) -> Url:
        """Convert Hugging Face file page URLs to direct download URLs."""
        return Url(
            re.sub(
                r"^(https?://huggingface\.co/[^/]+/[^/]+)/blob/([^?#]+)([?#].*)?$",
                r"\1/resolve/\2\3",
                str(url),
                flags=re.IGNORECASE,
            )
        )

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Use a HuggingFace repo URL of the form https://huggingface.co/<org>/<repo> (no extra path segments).
  2. For direct files, install via the local file path instead of a URL.
  3. Convert HF file/blob page URLs to repo-root URLs before passing them.
  4. For non-HF sources, download the model manually and scan it into InvokeAI from disk.

Example fix

// before
await invokeai.models.install({ source: 'https://civitai.com/models/12345' });
// after
await invokeai.models.install({ source: 'https://huggingface.co/black-forest-labs/FLUX.1-schnell' });
Defensive patterns

Strategy: validation

Validate before calling

import re
def is_hf_repo_url(url: str) -> bool:
    return bool(re.match(r"^https?://huggingface\.co/[^/]+/[^/]+$", url.lower()))
if not is_hf_repo_url(source):
    raise ValueError(f"Only HF repo URLs like https://huggingface.co/org/repo are supported, got: {source}")

Type guard

def is_supported_source(url: str) -> bool:
    return isinstance(url, str) and re.match(r"^https?://huggingface.co/[^/]+/[^/]+$", url.lower()) is not None

Prevention

When it happens

Trigger: Calling install/download APIs with a source URL that is not a HuggingFace repo page: a direct Civitai link, a raw file URL (e.g. huggingface.co/.../resolve/main/file.safetensors with extra path segments), a ModelScope or GitHub URL, or a plain http(s) URL with a path depth != 2.

Common situations: Users pasting Civitai or direct-download links into the model install dialog; code that previously supported multiple source types after the source support was reduced to HuggingFace; using HF blob/file URLs whose path depth exceeds the org/repo regex.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/abd70e657fb195b8. Report an issue: GitHub.