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 SQLite-backed strategy store maps a UNIQUE constraint on (artifacts.name, universe). register_artifact catches sqlite3.IntegrityError, and when the message mentions 'artifacts.name' it re-raises as this ValueError: the same artifact name is already registered for that universe.

Source

Thrown at agent/src/strategy_store/sqlite_store.py:435

                        now,
                        artifact.disabled_at,
                        artifact.disabled_reason,
                        artifact.developer,
                        artifact.owner,
                        artifact.validator,
                        artifact.approver,
                        artifact.model_version,
                        artifact.artifact_version,
                        artifact.model_tier.value if artifact.model_tier else None,
                        artifact.intended_use,
                        artifact.limitations,
                        artifact.validation_status.value,
                        artifact.validation_date,
                    ),
                )
        except sqlite3.IntegrityError as exc:
            if "artifacts.name" in str(exc):
                raise ValueError(
                    f"artifact '{artifact.name}' already exists in "
                    f"universe '{artifact.universe}'"
                ) from exc
            raise
        return artifact_id

    @_synchronized
    def get_artifact(self, artifact_id: str) -> Artifact | None:
        """Get a single artifact by ID.  Returns ``None`` if not found."""
        row = self._conn.execute(
            "SELECT * FROM artifacts WHERE id = ?", (artifact_id,)
        ).fetchone()
        return self._row_to_artifact(row) if row else None

    @_synchronized
    def list_artifacts(
        self,
        *,

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Check existence / use an upsert-style update path before registering
  2. Make batch jobs idempotent: skip or update when the (name, universe) pair already exists
  3. Serialize registrations per (name, universe) to avoid races

Example fix

# before
store.register_artifact(artifact)  # second time -> ValueError
# after
if store.get_artifact(artifact.name, artifact.universe) is None:
    store.register_artifact(artifact)
else:
    store.update_artifact(artifact.name, artifact)
Defensive patterns

Strategy: try-catch

Validate before calling

existing = store.get_artifact(artifact.name, artifact.universe)
if existing is not None:
    store.update_artifact(artifact.name, artifact)  # or skip
else:
    store.register_artifact(artifact)

Try / catch

try:
    store.register_artifact(artifact)
except ValueError as e:
    if 'already exists' in str(e): store.update_artifact(artifact.name, artifact)
    else: raise

Prevention

When it happens

Trigger: Calling register_artifact twice with the same name and universe, possibly from parallel workers or after a retry that already committed.

Common situations: Idempotency issues in batch registration scripts; retried HTTP handlers registering twice; re-running an import that partially succeeded before.

Related errors


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