HKUDS/Vibe-Trading · error · ValueError

timestamp must not be empty

Error message

timestamp must not be empty

What it means

build_run_manifest requires a non-empty timestamp string; empty or whitespace-only values are rejected so manifests always carry a creation time.

Source

Thrown at agent/src/governance/manifest.py:394

        tool_names: Tool registry names, e.g. ``ToolRegistry.tool_names``.
        package_versions: ``{package: version_or_None}``; see
            :func:`collect_key_package_versions` for a ready-made curated
            collector.
        extra: Small caller-defined composition dimensions (e.g.
            ``{"provider": "openrouter", "model": "deepseek/deepseek-v3.2"}``).

    Returns:
        A new :class:`RunManifest` with ``manifest_hash`` computed over the
        composition (excluding ``run_id``/``timestamp``).

    Raises:
        ValueError: ``run_id``/``timestamp`` is empty, or ``skills`` contains
            two records with the same name.
    """
    if not run_id or not run_id.strip():
        raise ValueError("run_id must not be empty")
    if not timestamp or not timestamp.strip():
        raise ValueError("timestamp must not be empty")

    if isinstance(skills, Mapping):
        skill_records = tuple(
            sorted(
                (SkillRecord.from_content(name, content) for name, content in skills.items()),
                key=lambda record: record.name,
            )
        )
    else:
        skill_records = tuple(sorted(skills, key=lambda record: record.name))
        names = [record.name for record in skill_records]
        if len(names) != len(set(names)):
            raise ValueError(f"duplicate skill names in manifest input: {names}")

    tools_snapshot = ToolRegistrySnapshot.from_names(tool_names)
    pv_pairs = _pairs(package_versions)
    extra_pairs = _pairs(extra)

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Pass an explicit ISO-8601 UTC timestamp, e.g. datetime.now(timezone.utc).isoformat()
  2. Default the timestamp at the call site when missing
  3. Validate required manifest inputs in one place before building

Example fix

# before
build_run_manifest(run_id=rid, timestamp=meta.get("ts", ""), ...)
# after
from datetime import datetime, timezone
ts = meta.get("ts") or datetime.now(timezone.utc).isoformat()
build_run_manifest(run_id=rid, timestamp=ts, ...)
Defensive patterns

Strategy: validation

Validate before calling

from datetime import datetime, timezone
timestamp = (timestamp or "").strip() or datetime.now(timezone.utc).isoformat()

Type guard

def is_valid_timestamp(ts: str) -> bool:
    return bool(ts and ts.strip())

Try / catch

except ValueError as e: if 'timestamp' in str(e): stamp with current UTC time and retry

Prevention

When it happens

Trigger: Calling build_run_manifest(timestamp="") or timestamp=" ", e.g. when the caller's clock/timestamp helper returned nothing.

Common situations: Timestamp sourced from an optional header or metadata dict that was absent; serialization dropping the field; tests omitting it.

Understand the failure class

Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.

Related errors


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