HKUDS/Vibe-Trading · error · ValueError
artifact '{artifact.name}' already exists in universe '{arti
Error message
artifact '{artifact.name}' already exists in universe '{artifact.universe}' What it means
The in-memory/file strategy store enforces the same uniqueness rule as the SQLite one: register_artifact scans existing artifacts and raises ValueError when an artifact with the same name and universe is already present, before any validation-status checks run.
Source
Thrown at agent/src/strategy_store/store.py:169
self._lock = threading.RLock()
self._artifacts: dict[str, Artifact] = {}
self._bench_results: list[BenchResult] = []
self._decay_snapshots: list[DecaySnapshot] = []
self._bench_counter: int = 0
self._decay_counter: int = 0
# -- Artifact CRUD -------------------------------------------------------
@_synchronized
def register_artifact(self, artifact: Artifact) -> str:
"""Register a new artifact, assigning an ID and timestamps.
Returns:
The assigned ``artifact_id``.
"""
for existing in self._artifacts.values():
if existing.name == artifact.name and existing.universe == artifact.universe:
raise ValueError(
f"artifact '{artifact.name}' already exists in "
f"universe '{artifact.universe}'"
)
# A brand-new record has no prior validation history, so its implicit
# "current" state is UNVALIDATED — registering directly with
# validation_status=APPROVED would skip the VALIDATED step.
validate_validation_status_transition(
ValidationStatus.UNVALIDATED, artifact.validation_status
)
now = _now_iso()
artifact_id = artifact.id or _new_artifact_id()
stored = replace(
artifact,
id=artifact_id,
created_at=artifact.created_at or now,
updated_at=now,
)
self._artifacts[artifact_id] = storedView on GitHub (pinned to 80ffdda44c)
Solutions
- Query the store for the (name, universe) pair first and update instead of re-registering
- Reset/recreate the store between import runs in scripts and tests
Example fix
# before
store.register_artifact(artifact)
# after
existing = next((a for a in store._artifacts.values() if a.name == artifact.name and a.universe == artifact.universe), None)
if existing is None:
store.register_artifact(artifact) Defensive patterns
Strategy: try-catch
Validate before calling
dup = any(a.name == artifact.name and a.universe == artifact.universe for a in store._artifacts.values())
if not dup:
store.register_artifact(artifact) Try / catch
try:
store.register_artifact(artifact)
except ValueError as e:
if 'already exists' in str(e): pass # idempotent re-registration
else: raise Prevention
- Reset stores between test cases and notebook re-runs
- Check for the (name, universe) pair before registering
- Treat register as create-only; use update for changes
When it happens
Trigger: Registering the same artifact twice into the same store instance (e.g. via _register_active_artifact in tests or replays), or reloading an import script without a fresh store.
Common situations: Notebook sessions re-running a registration cell; test fixtures that forget to reset the store; dual-writing code paths registering the active artifact again.
Related errors
- cannot mark a model APPROVED from validation_status={current
- intended_use is required and must be non-empty
- limitations is required and must be non-empty
- artifact '{artifact.name}' already exists in universe '{arti
- invalid alpha_id
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/3404c34c877363b0.
Report an issue: GitHub.