{"record":{"id":"6e600b06d9ed37f8","repo":"HKUDS/Vibe-Trading","slug":"preset-name-r-not-found-in-redact-home-user-pr","errorCode":null,"errorMessage":"Preset {name!r} not found in {_redact_home(USER_PRESETS_DIR)} or the bundled presets. Available: {available}","messagePattern":"Preset (.+?) not found in (.+?) or the bundled presets\\. Available: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"agent/src/swarm/presets.py","lineNumber":104,"sourceCode":"\n    Returns:\n        Parsed YAML dict.\n\n    Raises:\n        ValueError: If the name is empty or contains path separators.\n        FileNotFoundError: If the preset file does not exist in either the\n            user directory (``~/.vibe-trading/swarm/presets/``) or the\n            bundled package directory.\n    \"\"\"\n    path = resolve_preset_path(name)\n    if path is None:\n        available = sorted({\n            p.stem\n            for directory in _preset_search_dirs()\n            if directory.exists()\n            for p in directory.glob(\"*.yaml\")\n        })\n        raise FileNotFoundError(\n            f\"Preset {name!r} not found in {_redact_home(USER_PRESETS_DIR)} or \"\n            f\"the bundled presets. Available: {available}\"\n        )\n    return yaml.safe_load(path.read_text(encoding=\"utf-8\"))\n\n\ndef list_presets() -> list[dict]:\n    \"\"\"Return summary info for all available presets, sorted by name.\n\n    User presets (``~/.vibe-trading/swarm/presets/``) are listed alongside the\n    bundled roster; when both directories carry the same file stem, the user\n    preset wins — the same override rule as user skills.\n\n    Returns:\n        List of dicts with keys: name, title, description, agent_count,\n        variables, source (``\"user\"`` or ``\"bundled\"``).\n    \"\"\"\n    by_stem: dict[str, dict] = {}","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/swarm/presets.py#L86-L122","documentation":"load_preset searched USER_PRESETS_DIR and the bundled presets directory for '<name>.yaml' and found nothing. The FileNotFoundError helpfully lists the home directory (redacted) plus all available preset stems.","triggerScenarios":"load_preset('my-preset') when only my-preset.yml (wrong extension) exists; typo in the name; user preset written to the wrong directory; bundled preset renamed between versions.","commonSituations":"Version upgrades renaming bundled presets; users creating .yml instead of .yaml; CI environments lacking the user presets dir.","solutions":["Read the 'Available: [...]' list in the error message and use one of those names","Ensure your custom preset is a .yaml file directly inside USER_PRESETS_DIR","Check spelling and version changelog if a bundled preset disappeared"],"exampleFix":"# before\nload_preset('fullresearch')  # FileNotFoundError\n# after\nload_preset('research-full')  # exact stem from the Available list","handlingStrategy":"try-catch","validationCode":"from pathlib import Path\nfrom agent.src.swarm.presets import USER_PRESETS_DIR, PRESETS_DIR\navailable = {p.stem for d in (USER_PRESETS_DIR, PRESETS_DIR) if d.exists() for p in d.glob('*.yaml')}\nif name not in available: name = 'default'  # or report list","typeGuard":"def preset_exists(name: str) -> bool:\n    from agent.src.swarm.presets import USER_PRESETS_DIR, PRESETS_DIR\n    return any((d / f'{name}.yaml').exists() for d in (USER_PRESETS_DIR, PRESETS_DIR) if d.exists())","tryCatchPattern":"try:\n    cfg = load_preset(name)\nexcept FileNotFoundError as e:\n    # e.message lists available presets; surface it to the user\n    raise SystemExit(str(e))","preventionTips":["Use .yaml extension for user presets","Wrap user-facing preset selection and show the Available list","Pin preset names in configs and review them on version upgrades"],"tags":["python","file-not-found","yaml","presets"],"backgroundTag":"file-not-found","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}