HKUDS/Vibe-Trading · error · ValueError

provide exactly one of manifest_path or runs, not both

Error message

provide exactly one of manifest_path or runs, not both

What it means

refresh_strategy_evidence_core takes mutually exclusive inputs: you must pass exactly one of manifest_path (path to a manifest file) or runs (inline array of run entries). Passing both raises immediately; passing neither raises a companion error. This prevents ambiguous sources of truth for the refresh set.

Source

Thrown at agent/src/tools/strategy_discovery_tool.py:605

    """Shared refresh core for the agent tool and the CLI (one code path).

    Validates the exactly-one-source rule, loads the manifest (or accepts
    inline ``runs``), validates every entry (path containment included), and
    rebuilds the DEFAULT evidence store — ``EvidenceStore()`` resolution:
    env override → runtime root → ``~/.vibe-trading``; NEVER a CWD-relative
    path.

    Returns:
        The strict envelope ``{status, runs, strategies, rows, skipped}``
        where ``runs`` counts every supplied entry (processed + skipped) and
        ``skipped`` merges entry-level skips with harness skips.

    Raises:
        ValueError: Operator-facing usage errors (exactly-one rule violated,
            manifest missing/invalid/wrong shape, ``runs`` not an array).
    """
    if manifest_path is not None and runs is not None:
        raise ValueError("provide exactly one of manifest_path or runs, not both")
    if manifest_path is None and runs is None:
        raise ValueError(
            "refresh_strategy_evidence requires exactly one of manifest_path " "or runs"
        )
    if manifest_path is not None:
        entries = load_manifest(manifest_path)
    else:
        if not isinstance(runs, list):
            raise ValueError(
                "runs must be an array of {strategy_id, run_dir, "
                "position_size?} objects"
            )
        entries = runs

    specs, skipped = validate_refresh_entries(entries)
    if not specs:
        # Nothing admissible to rebuild from. Do NOT call rebuild_evidence:
        # an empty rebuild clears the store, and wiping the cache because

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Pass only one: either manifest_path="..." or runs=[{...}], never both
  2. In wrapper code, build kwargs conditionally: include only the argument that is actually set
  3. If you have inline run dicts, prefer runs and drop manifest_path; if the runs live in a file, drop runs

Example fix

# before
refresh_strategy_evidence_core(manifest_path="m.json", runs=entries)
# after
refresh_strategy_evidence_core(runs=entries)  # or manifest_path="m.json" alone
Defensive patterns

Strategy: validation

Validate before calling

if (manifest_path is None) == (runs is None):
    raise ValueError("pass exactly one of manifest_path or runs")
refresh_strategy_evidence_core(manifest_path=manifest_path, runs=runs, ...)

Try / catch

except ValueError as e: if 'exactly one' in str(e): drop one of the two args and retry

Prevention

When it happens

Trigger: Calling refresh_strategy_evidence(manifest_path="m.json", runs=[...]) with both arguments; commonly happens when a wrapper forwards a full kwargs dict unconditionally.

Common situations: Wrapper functions defaulting both args and forwarding everything; LLM tool calls filling all schema fields; refactors that started with runs and later added manifest_path without removing the other.

Related errors


AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28). Data as JSON: /api/errors/b0fc685d17e570da. Report an issue: GitHub.