{"record":{"id":"45d5100985f72240","repo":"invoke-ai/InvokeAI","slug":"external-api-models-are-not-probed-from-disk","errorCode":null,"errorMessage":"external API models are not probed from disk","messagePattern":"external API models are not probed from disk","errorType":"validation","errorClass":"NotAMatchError","httpStatus":null,"severity":"warning","filePath":"invokeai/backend/model_manager/configs/external_api.py","lineNumber":113,"sourceCode":"    source: str = Field(default=\"\")\n    hash: str = Field(default=\"\")\n    file_size: int = Field(default=0, ge=0)\n\n    model_config = ConfigDict(extra=\"forbid\")\n\n    @model_validator(mode=\"after\")\n    def _populate_external_fields(self) -> \"ExternalApiModelConfig\":\n        if not self.path:\n            self.path = f\"external://{self.provider_id}/{self.provider_model_id}\"\n        if not self.source:\n            self.source = self.path\n        if not self.hash:\n            self.hash = f\"external:{self.provider_id}:{self.provider_model_id}\"\n        return self\n\n    @classmethod\n    def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, object]) -> Self:\n        raise NotAMatchError(\"external API models are not probed from disk\")\n","sourceCodeStart":95,"sourceCodeEnd":114,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/configs/external_api.py#L95-L114","documentation":"External API model configs (models served by remote providers, identified by provider_id + provider_model_id) are created from API listings, never probed from files on disk. Their from_model_on_disk therefore unconditionally raises NotAMatchError. This is expected behavior: a file probe should never resolve to an ExternalApiModelConfig.","triggerScenarios":"Model-manager probe/install flow iterating config classes and calling from_model_on_disk on a file, reaching the external-API config class; custom code explicitly calling ExternalApiModelConfig.from_model_on_disk with a ModelOnDisk.","commonSituations":"Writing a custom model-install routine that probes all config subclasses against local files; a bug in registration order causing external API configs to be consulted during disk probing.","solutions":["Do not include external API configs in disk-probe candidate lists; create them via the provider API sync instead","Instantiate external API models directly with provider_id and provider_model_id (hash auto-generated as external:<provider>:<model>)","Catch NotAMatchError in probe loops and continue to the next config class — this raise is the intended 'not applicable' signal","File a bug if InvokeAI's own installer routes local files to the external-API config"],"exampleFix":"// before\ncfg = ExternalApiModelConfig.from_model_on_disk(mod, override_fields)\n// after\ncfg = ExternalApiModelConfig(provider_id=\"openai\", provider_model_id=\"gpt-image-1\")","handlingStrategy":"try-catch","validationCode":"from invokeai.backend.model_manager.configs.external_api import ExternalApiModelConfig\n\ndef should_probe_on_disk(cls) -> bool:\n    return not issubclass(cls, ExternalApiModelConfig)","typeGuard":null,"tryCatchPattern":"try:\n    config = cls.from_model_on_disk(mod, override_fields)\nexcept NotAMatchError:\n    continue  # expected for external API configs in a probe loop","preventionTips":["Exclude external API config classes from disk-probe candidate lists","Create external API models via provider sync APIs, not file probing","Treat NotAMatchError as a normal probe rejection, not a bug","Verify model sources before writing custom install pipelines"],"tags":["python","external-api","model-manager","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}