abhigyanpatwari/GitNexus · error · FileNotFoundError

Mode config not found: {mode_file}

Error message

Mode config not found: {mode_file}

What it means

Thrown by build_config() in eval/run_eval.py: it looks for eval/configs/modes/<mode_name>.yaml (MODES_DIR) and raises FileNotFoundError if it does not exist. AVAILABLE_MODES is computed by globbing that directory at import; the error message gives the resolved missing path.

Source

Thrown at eval/run_eval.py:104

    result = {}
    for config in configs:
        for key, value in config.items():
            if key in result and isinstance(result[key], dict) and isinstance(value, dict):
                result[key] = merge_configs(result[key], value)
            else:
                result[key] = value
    return result


def build_config(model_name: str, mode_name: str) -> dict:
    """Build a complete config from model + mode YAML files."""
    model_file = MODELS_DIR / f"{model_name}.yaml"
    mode_file = MODES_DIR / f"{mode_name}.yaml"

    if not model_file.exists():
        raise FileNotFoundError(f"Model config not found: {model_file}")
    if not mode_file.exists():
        raise FileNotFoundError(f"Mode config not found: {mode_file}")

    model_config = load_yaml_config(model_file)
    mode_config = load_yaml_config(mode_file)

    return merge_configs(mode_config, model_config)


def load_instances(subset: str, split: str, slice_spec: str = "", filter_spec: str = "") -> list[dict]:
    """Load SWE-bench instances."""
    from datasets import load_dataset
    import re

    dataset_path = DATASET_MAPPING.get(subset, subset)
    logger.info(f"Loading dataset: {dataset_path}, split: {split}")
    instances = list(load_dataset(dataset_path, split=split))

    if filter_spec:
        instances = [i for i in instances if re.match(filter_spec, i["instance_id"])]

View on GitHub (pinned to d540b00184)

Solutions

  1. List available modes: `ls eval/configs/modes/` (or print AVAILABLE_MODES).
  2. Create eval/configs/modes/<mode_name>.yaml with the mode's settings (agent, environment, max iterations, etc.).
  3. Fix the typo / case on the --mode argument to match a filename stem exactly.
  4. Run from the eval/ directory or ensure CONFIGS_DIR points to the right place.

Example fix

# before
python run_eval.py --model claude-sonnet --mode workfow
# FileNotFoundError: Mode config not found: eval/configs/modes/workfow.yaml

# after
python run_eval.py --model claude-sonnet --mode workflow
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
MODES_DIR = Path(__file__).parent / 'configs' / 'modes'
def resolve_mode(name: str) -> Path:
    p = (MODES_DIR / f'{name}.yaml')
    if not p.exists():
        avail = sorted(x.stem for x in MODES_DIR.glob('*.yaml'))
        raise SystemExit(f'Unknown mode {name!r}. Available: {avail}')
    return p

Type guard

def mode_config_exists(name: str) -> bool:
    return (MODES_DIR / f'{name}.yaml').exists()

Try / catch

try:
    cfg = build_config(model_name, mode_name)
except FileNotFoundError as e:
    if 'Mode config' in str(e):
        print('available:', AVAILABLE_MODES); raise
    raise

Prevention

When it happens

Trigger: Calling run_eval with --mode <name> where <name>.yaml is absent from eval/configs/modes/. Examples: typo 'workfow' vs 'workflow'; a mode yaml never authored; running from a different cwd so MODES_DIR resolves elsewhere.

Common situations: Mode-name typo; new mode not yet added as a yaml; relative path resolution off because of cwd; case mismatch in the mode name.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12). Data as JSON: /api/errors/20d97bcb55149eab. Report an issue: GitHub.