{"record":{"id":"70fc938eb967842d","repo":"invoke-ai/InvokeAI","slug":"unknown-override-field-field-name","errorCode":null,"errorMessage":"unknown override field: {field_name}","messagePattern":"unknown override field: (.+?)","errorType":"validation","errorClass":"NotAMatchError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/configs/identification_utils.py","lineNumber":150,"sourceCode":"def raise_for_override_fields(candidate_config_class: type[BaseModel], override_fields: dict[str, Any]) -> None:\n    \"\"\"Check if the provided override fields are valid for the config class using pydantic.\n\n    For example, if the candidate config class has a field \"base\" of type Literal[BaseModelType.StableDiffusion1], and\n    the override fields contain \"base\": BaseModelType.Flux, this function will raise NotAMatch.\n\n    Internally, this function extracts the pydantic schema for each individual override field from the candidate config\n    class and validates the override value against that schema. Post-instantiation validators are not run.\n\n    Args:\n        candidate_config_class: The config class that is being tested.\n        override_fields: The override fields provided by the user.\n\n    Raises:\n        NotAMatch if any override field is invalid for the config class.\n    \"\"\"\n    for field_name, override_value in override_fields.items():\n        if field_name not in candidate_config_class.model_fields:\n            raise NotAMatchError(f\"unknown override field: {field_name}\")\n        try:\n            PydanticFieldValidator.validate_field(candidate_config_class, field_name, override_value)\n        except ValidationError as e:\n            raise NotAMatchError(f\"invalid override for field '{field_name}': {e}\") from e\n\n\ndef raise_if_not_file(mod: ModelOnDisk) -> None:\n    \"\"\"Raise NotAMatch if the model path is not a file.\"\"\"\n    if not mod.path.is_file():\n        raise NotAMatchError(\"model path is not a file\")\n\n\ndef raise_if_not_dir(mod: ModelOnDisk) -> None:\n    \"\"\"Raise NotAMatch if the model path is not a directory.\"\"\"\n    if not mod.path.is_dir():\n        raise NotAMatchError(\"model path is not a directory\")\n\n","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/configs/identification_utils.py#L132-L168","documentation":"raise_for_override_fields validates user-supplied override fields against the candidate config class's pydantic model_fields before applying them in from_model_on_disk. If an override key does not exist on that config class, NotAMatchError is raised. This prevents silently ignoring typos or fields that belong to a different config class.","triggerScenarios":"Calling from_model_on_disk with override_fields containing a key not defined on the candidate config class (e.g. override field \"variant\" on a config that has no such pydantic field).","commonSituations":"Typos in override field names; copying overrides between different model types (checkpoint vs diffusers vs LoRA configs); API invocations from stale clients using fields removed in an InvokeAI version bump.","solutions":["Check the candidate config class's pydantic fields and correct the override field name spelling.","Remove overrides that don't apply to this model type.","Use the config record's `default_settings` or the correct config class that defines the field.","Update client code if the field was renamed in a newer InvokeAI version."],"exampleFix":"// before\nfrom_model_on_disk(mod, config_class, override_fields={\"varient\": \"fp16\"})\n// after\nfrom_model_on_disk(mod, config_class, override_fields={\"variant\": \"fp16\"})","handlingStrategy":"validation","validationCode":"valid = set(candidate_config_class.model_fields)\nbad = set(override_fields) - valid\nassert not bad, f\"unknown override fields: {bad}; valid fields: {sorted(valid)}\"","typeGuard":"def overrides_are_known(cfg_cls, overrides: dict) -> bool:\n    return all(k in cfg_cls.model_fields for k in overrides)","tryCatchPattern":"try:\n    record = from_model_on_disk(mod, config_class, override_fields=overrides)\nexcept NotAMatchError as e:\n    if \"unknown override field\" in str(e):\n        logger.error(\"bad override fields in request: %s\", e)\n        raise HTTPException(422, str(e)) from e","preventionTips":["Derive override keys from the config class schema, never from free-form user input","Use IDE/pydantic autocomplete against the config class fields","Add a schema check in API request validation before reaching the model manager"],"tags":["validation","pydantic","invokeai"],"backgroundTag":"unknown-field-override","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}