HKUDS/Vibe-Trading · error · ValueError
title is required
Error message
title is required
What it means
build_job_from_draft requires a non-empty draft['title'] after stripping whitespace. The title identifies the scheduled research job in listings and notifications, so it cannot be blank.
Source
Thrown at agent/src/scheduled_research/service.py:123
config = getattr(session, "config", None) or {}
channel = config.get("channel")
target = config.get("channel_chat_id")
if not isinstance(channel, str) or not isinstance(target, str):
raise ValueError("the originating session is not an IM conversation")
return channel, target, None, "当前会话"
def build_job_from_draft(
draft: Mapping[str, Any],
*,
session_id: str | None = None,
now_ms: int | None = None,
) -> ScheduledResearchJob:
"""Validate the public draft and build a persisted-model job."""
now = int(time.time() * 1000) if now_ms is None else now_ms
title = str(draft.get("title") or "").strip()
if not title:
raise ValueError("title is required")
source = draft.get("source")
schedule_spec = draft.get("schedule")
delivery_spec = draft.get("delivery") or {"mode": "in_app"}
if not isinstance(source, Mapping) or not isinstance(schedule_spec, Mapping):
raise ValueError("source and schedule must be objects")
if not isinstance(delivery_spec, Mapping):
raise ValueError("delivery must be an object")
source_type = str(source.get("kind") or "prompt")
playbook_slug = None
config: dict[str, Any] = {}
if source_type == "prompt":
prompt = str(source.get("prompt") or "").strip()
if not prompt:
raise ValueError("source.prompt is required")
elif source_type == "playbook":
playbook_slug = str(source.get("playbook_slug") or "").strip()
if not playbook_slug:View on GitHub (pinned to 80ffdda44c)
Solutions
- Provide a non-empty title in the draft
- Trim client-side and validate before submitting
- Make the title field required in the form schema
Example fix
// before
{"title": " "}
// after
{"title": "Daily competitor digest"} Defensive patterns
Strategy: validation
Validate before calling
assert str(draft.get("title") or "").strip(), "title is required" Type guard
def has_title(draft: dict) -> bool:
return bool(str(draft.get("title") or "").strip()) Try / catch
try:
propose_create(draft)
except ValueError as e:
mark_required_field("title") if "title" in str(e) else raise_ Prevention
- Make title mandatory in UI forms
- Validate required fields before the API round-trip
When it happens
Trigger: Omitting 'title' from the draft JSON, sending "" or " ", or a form field that never got bound.
Common situations: UI forms where title is optional client-side but required server-side; JSON payloads built from templates with an unfilled title placeholder; whitespace-only input from copy-paste.
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
- source.prompt is required
- source.playbook_slug is required
- delivery.target_ref is required for configured delivery
- title is required
- thesis is required
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/38ef0e205f1067f6.
Report an issue: GitHub.