HKUDS/Vibe-Trading · error · ValueError
{field_name}={value!r} is not ISO-8601 (YYYY-MM-DD); pass an
Error message
{field_name}={value!r} is not ISO-8601 (YYYY-MM-DD); pass an explicit date_format instead of relying on inference What it means
normalize_date tries ISO-8601 (date and datetime) parsing on strings and, when both fail, raises with the offending value and a hint to pass an explicit date_format instead of relying on inference.
Source
Thrown at agent/src/entities/models.py:131
Raises:
ValueError: If the value is not a supported type or not ISO-8601.
"""
if isinstance(value, datetime):
return value.date()
if isinstance(value, date):
return value
if isinstance(value, str):
text = value.strip()
if not text:
raise ValueError(f"{field_name} is required and cannot be empty")
try:
return date.fromisoformat(text)
except ValueError:
pass
try:
return datetime.fromisoformat(text).date()
except ValueError as exc:
raise ValueError(
f"{field_name}={value!r} is not ISO-8601 (YYYY-MM-DD); pass an "
"explicit date_format instead of relying on inference"
) from exc
raise ValueError(
f"{field_name} must be a date, datetime, or ISO-8601 string, "
f"got {type(value).__name__}"
)
@dataclass(frozen=True)
class Entity:
"""A legal entity that issues, manages, or faces an instrument.
Attributes:
entity_id: Stable identifier, e.g. an LEI, a CIK, or a local key.
name: Human-readable legal name.
entity_type: Role the entity plays; see ``EntityType``.
domicile: Country or jurisdiction code, free-form and optional.View on GitHub (pinned to 80ffdda44c)
Solutions
- Normalize to ISO: pd.to_datetime(v).date() or datetime.strptime upstream
- Pass an explicit date_format where the API supports it (e.g. load_panel(date_format='%d/%m/%Y'))
- Convert strings to datetime.date objects before passing
Example fix
# before
panel = load_panel('p.csv') # dates like 31/03/2024
# after
panel = load_panel('p.csv', date_format='%d/%m/%Y') Defensive patterns
Strategy: validation
Validate before calling
from datetime import datetime try: datetime.fromisoformat(d.strip()) except ValueError: d = datetime.strptime(d.strip(), '%d/%m/%Y').date().isoformat()
Try / catch
except ValueError as e:
if 'not ISO-8601' in str(e): parse with strptime/date_format and retry Prevention
- Always pass date_format for non-ISO sources
- Normalize dates to ISO at ingestion
When it happens
Trigger: Passing date strings like '2024/03/31', '31-03-2024', or 'Mar 2024' anywhere a date is expected without a date_format.
Common situations: Locale-formatted exports (DD/MM/YYYY), slash-separated dates, or month-name formats from spreadsheets.
Related errors
- {field_name} must be a date, datetime, or ISO-8601 string, g
- {field_name} must be a string, got {type(value).__name__}
- {field_name} is required and cannot be empty
- {field_name} cannot contain whitespace, got {value!r}
- entity_id is required and cannot be empty
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/a31c484aa3036a8b.
Report an issue: GitHub.