{"record":{"id":"d551b1085de8b284","repo":"abhigyanpatwari/GitNexus","slug":"model-config-not-found-model-file","errorCode":null,"errorMessage":"Model config not found: {model_file}","messagePattern":"Model config not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"eval/run_eval.py","lineNumber":102,"sourceCode":"def merge_configs(*configs: dict) -> dict:\n    \"\"\"Recursively merge multiple config dicts (later values win).\"\"\"\n    result = {}\n    for config in configs:\n        for key, value in config.items():\n            if key in result and isinstance(result[key], dict) and isinstance(value, dict):\n                result[key] = merge_configs(result[key], value)\n            else:\n                result[key] = value\n    return result\n\n\ndef build_config(model_name: str, mode_name: str) -> dict:\n    \"\"\"Build a complete config from model + mode YAML files.\"\"\"\n    model_file = MODELS_DIR / f\"{model_name}.yaml\"\n    mode_file = MODES_DIR / f\"{mode_name}.yaml\"\n\n    if not model_file.exists():\n        raise FileNotFoundError(f\"Model config not found: {model_file}\")\n    if not mode_file.exists():\n        raise FileNotFoundError(f\"Mode config not found: {mode_file}\")\n\n    model_config = load_yaml_config(model_file)\n    mode_config = load_yaml_config(mode_file)\n\n    return merge_configs(mode_config, model_config)\n\n\ndef load_instances(subset: str, split: str, slice_spec: str = \"\", filter_spec: str = \"\") -> list[dict]:\n    \"\"\"Load SWE-bench instances.\"\"\"\n    from datasets import load_dataset\n    import re\n\n    dataset_path = DATASET_MAPPING.get(subset, subset)\n    logger.info(f\"Loading dataset: {dataset_path}, split: {split}\")\n    instances = list(load_dataset(dataset_path, split=split))\n","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/run_eval.py#L84-L120","documentation":"Thrown by build_config() in eval/run_eval.py: it looks for eval/configs/models/<model_name>.yaml (MODELS_DIR) and raises FileNotFoundError if it does not exist. AVAILABLE_MODELS is computed at import time by globbing that directory, so the message tells you the resolved path that was missing.","triggerScenarios":"Calling run_eval with --model <name> where <name>.yaml is not present under eval/configs/models/. Examples: typo 'claude-sonet' vs 'claude-sonnet'; a model file that was never added; running from a different working directory so MODELS_DIR resolves elsewhere.","commonSituations":"Model-name typo on the CLI; new model not yet given a config yaml; running the eval from outside the eval/ directory so the relative CONFIGS_DIR is wrong; case mismatch (Claude-Sonnet vs claude-sonnet).","solutions":["List available models: `ls eval/configs/models/` (or print AVAILABLE_MODELS in the script).","Create eval/configs/models/<model_name>.yaml with the required model fields (api base, model id, etc.).","Fix the typo / case on the --model argument to match a filename stem exactly.","Run the eval from the eval/ directory (or pass absolute paths) so MODELS_DIR resolves correctly."],"exampleFix":"# before\npython run_eval.py --model claude-sonet --mode workflow\n# FileNotFoundError: Model config not found: eval/configs/models/claude-sonet.yaml\n\n# after\npython run_eval.py --model claude-sonnet --mode workflow\n# or add the file: eval/configs/models/claude-sonet.yaml","handlingStrategy":"validation","validationCode":"from pathlib import Path\nMODELS_DIR = Path(__file__).parent / 'configs' / 'models'\ndef resolve_model(name: str) -> Path:\n    p = (MODELS_DIR / f'{name}.yaml')\n    if not p.exists():\n        avail = sorted(x.stem for x in MODELS_DIR.glob('*.yaml'))\n        raise SystemExit(f'Unknown model {name!r}. Available: {avail}')\n    return p\n# call before build_config()","typeGuard":"def model_config_exists(name: str) -> bool:\n    return (MODELS_DIR / f'{name}.yaml').exists()","tryCatchPattern":"try:\n    cfg = build_config(model_name, mode_name)\nexcept FileNotFoundError as e:\n    if 'Model config' in str(e):\n        print('available:', AVAILABLE_MODELS); raise\n    raise","preventionTips":["Always print AVAILABLE_MODELS in --help output.","Validate --model against the directory listing at CLI parse time, not deep inside build_config.","Run the eval from the eval/ directory so relative CONFIGS_DIR resolves correctly."],"tags":["eval","configuration","yaml","cli"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}