HKUDS/Vibe-Trading · error · FileNotFoundError
Preset {name!r} not found in {_redact_home(USER_PRESETS_DIR)
Error message
Preset {name!r} not found in {_redact_home(USER_PRESETS_DIR)} or the bundled presets. Available: {available} What it means
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.
Source
Thrown at agent/src/swarm/presets.py:104
Returns:
Parsed YAML dict.
Raises:
ValueError: If the name is empty or contains path separators.
FileNotFoundError: If the preset file does not exist in either the
user directory (``~/.vibe-trading/swarm/presets/``) or the
bundled package directory.
"""
path = resolve_preset_path(name)
if path is None:
available = sorted({
p.stem
for directory in _preset_search_dirs()
if directory.exists()
for p in directory.glob("*.yaml")
})
raise FileNotFoundError(
f"Preset {name!r} not found in {_redact_home(USER_PRESETS_DIR)} or "
f"the bundled presets. Available: {available}"
)
return yaml.safe_load(path.read_text(encoding="utf-8"))
def list_presets() -> list[dict]:
"""Return summary info for all available presets, sorted by name.
User presets (``~/.vibe-trading/swarm/presets/``) are listed alongside the
bundled roster; when both directories carry the same file stem, the user
preset wins — the same override rule as user skills.
Returns:
List of dicts with keys: name, title, description, agent_count,
variables, source (``"user"`` or ``"bundled"``).
"""
by_stem: dict[str, dict] = {}View on GitHub (pinned to 80ffdda44c)
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
Example fix
# before
load_preset('fullresearch') # FileNotFoundError
# after
load_preset('research-full') # exact stem from the Available list Defensive patterns
Strategy: try-catch
Validate before calling
from pathlib import Path
from agent.src.swarm.presets import USER_PRESETS_DIR, PRESETS_DIR
available = {p.stem for d in (USER_PRESETS_DIR, PRESETS_DIR) if d.exists() for p in d.glob('*.yaml')}
if name not in available: name = 'default' # or report list Type guard
def preset_exists(name: str) -> bool:
from agent.src.swarm.presets import USER_PRESETS_DIR, PRESETS_DIR
return any((d / f'{name}.yaml').exists() for d in (USER_PRESETS_DIR, PRESETS_DIR) if d.exists()) Try / catch
try:
cfg = load_preset(name)
except FileNotFoundError as e:
# e.message lists available presets; surface it to the user
raise SystemExit(str(e)) Prevention
- 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
When it happens
Trigger: 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.
Common situations: Version upgrades renaming bundled presets; users creating .yml instead of .yaml; CI environments lacking the user presets dir.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Run directory not found: {rd.name}
- Task not found: {path.name}
- invalid alpha_id
- alpha_id not found
- invalid period: {exc}
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/6e600b06d9ed37f8.
Report an issue: GitHub.