invoke-ai/InvokeAI · error · ValueError
No model files or config files found in directory {path}. Ex
Error message
No model files or config files found in directory {path}. Expected to find model files with extensions: {extensions} or config files: {config_files} What it means
After extension and file-count checks pass, the validator searches the directory (within a depth limit) for any file with a recognized model extension or a known config file. Finding neither, it raises this ValueError: the directory exists and is small enough, but contains no recognizable model artifacts.
Source
Thrown at invokeai/backend/model_manager/configs/factory.py:622
"Please provide a path to a specific model file or model directory."
)
# Otherwise, search for model files within depth limit
def find_model_files(current_path: Path, depth: int) -> bool:
if depth > _MAX_SEARCH_DEPTH:
return False
try:
for item in current_path.iterdir():
if item.is_file() and item.suffix.lower() in _MODEL_EXTENSIONS:
return True
elif item.is_dir() and find_model_files(item, depth + 1):
return True
except PermissionError:
pass
return False
if not find_model_files(path, 0):
raise ValueError(
f"No model files or config files found in directory {path}. "
f"Expected to find model files with extensions: {', '.join(sorted(_MODEL_EXTENSIONS))} "
f"or config files: {', '.join(sorted(_CONFIG_FILES))}"
)
@staticmethod
def matches_sort_key(m: AnyModelConfig) -> int:
"""Sort key function to prioritize model config matches in case of multiple matches."""
# It is possible that we have multiple matches. We need to prioritize them.
# Known cases where multiple matches can occur:
# - SD main models can look like a LoRA when they have merged in LoRA weights. Prefer the main model.
# - SD main models in diffusers format can look like a CLIP Embed; they have a text_encoder folder with
# a config.json file. Prefer the main model.
# Given the above cases, we can prioritize the matches by type. If we find more cases, we may need a more
# sophisticated approach.View on GitHub (pinned to 0b6a024f2f)
Solutions
- Verify the directory actually contains weights files (ls the directory; check extensions like .safetensors/.bin/.ckpt or config files)
- Re-run the download/extraction — the folder is likely an artifact of a failed install
- Fix filesystem permissions if files exist but are unreadable (PermissionError is silently ignored during search)
- Point at the correct subdirectory containing the model files
Example fix
// before
install_model("/models/sdxl/venv_empty") # no weights inside
// after
assert any(f.suffix in {".safetensors", ".bin", ".ckpt"} for f in pathlib.Path("/models/sdxl").rglob("*"))
install_model("/models/sdxl") Defensive patterns
Strategy: validation
Validate before calling
import pathlib
_MODEL_EXTS = {".safetensors", ".ckpt", ".pt", ".bin", ".pth", ".gguf"}
_CONFIGS = {"config.json", "model_index.json"}
def dir_has_model_artifacts(path: str) -> bool:
for f in pathlib.Path(path).rglob("*"):
if f.suffix.lower() in _MODEL_EXTS or f.name in _CONFIGS:
return True
return False Try / catch
try:
install_model(path)
except ValueError as e:
if "No model files or config files found" in str(e):
logger.error("Directory has no recognizable weights/config; re-download the model")
else:
raise Prevention
- Confirm downloads completed (weights present) before importing
- Check directory contents with ls before install
- Fix read permissions if files exist but are unreadable
- Point at the model subdirectory, not an empty parent
When it happens
Trigger: from_model_on_disk given an empty directory, a directory holding only unrelated files (images, logs, docs), or a directory whose model weights use unrecognized extensions; also after a failed download that removed all weight files but left the folder.
Common situations: Cancelled/partial download leaving an empty model folder; extracting an archive into the wrong structure; pointing at a LoRA metadata folder with no weights; permissions masking files (PermissionError is swallowed in the search).
Related errors
- Directory contains more than {_MAX_FILES_IN_MODEL_DIR} files
- File extension {path.suffix} is not a recognized model forma
- The Anima ControlNet-LLLite model '{lllite_field.control_mod
- This Anima ControlNet-LLLite adapter is an inpainting adapte
- Unsupported Anima ControlNet-LLLite adapter: expected 3 or 4
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/5c80755cbe042ede.
Report an issue: GitHub.