HKUDS/Vibe-Trading · error · ValueError

thesis is required

Error message

thesis is required

What it means

HypothesisRegistry.create requires a non-blank thesis statement alongside the title. The thesis describes the economic rationale being tested, so an empty one is rejected before persistence.

Source

Thrown at agent/src/hypotheses/registry.py:193

            status: Initial lifecycle status.
            universe: Target market or asset universe.
            signal_definition: Signal logic.
            data_sources: Source names.
            skills: Related Vibe-Trading skills.
            invalidation_notes: Initial invalidation notes.

        Returns:
            Created hypothesis.

        Raises:
            ValueError: If title/thesis/status are invalid.
        """
        title = title.strip()
        thesis = thesis.strip()
        if not title:
            raise ValueError("title is required")
        if not thesis:
            raise ValueError("thesis is required")

        records = self.list()
        now = _utc_now()
        hyp = Hypothesis(
            hypothesis_id=_new_hypothesis_id(title, now, {h.hypothesis_id for h in records}),
            title=title,
            thesis=thesis,
            status=_validate_status(status),
            universe=universe.strip(),
            signal_definition=signal_definition.strip(),
            data_sources=_coerce_str_list(data_sources),
            skills=_coerce_str_list(skills),
            invalidation_notes=invalidation_notes.strip(),
            created_at=now,
            updated_at=now,
        )
        records.append(hyp)
        self._save(records)

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Provide a non-blank thesis describing the testable rationale
  2. Validate both title and thesis in the caller before invoking create

Example fix

# before
registry.create(title="Momentum", thesis=" ")
# after
registry.create(title="Momentum", thesis="Returns persist due to slow information diffusion")
Defensive patterns

Strategy: validation

Validate before calling

title, thesis = (title or '').strip(), (thesis or '').strip()
if not title or not thesis:
    raise ValueError('title and thesis are both required')

Type guard

def is_valid_hypothesis_payload(title, thesis) -> bool:
    return bool((title or '').strip() and (thesis or '').strip())

Try / catch

try:
    registry.create(title=title, thesis=thesis)
except ValueError as exc:
    # distinguish blank fields from other validation errors via str(exc)
    log.warning('create rejected: %s', exc)

Prevention

When it happens

Trigger: Calling registry.create(title=..., thesis="") or thesis with only whitespace; forwarding a null/empty thesis from user input that gets stringified to ''.

Common situations: Partial form submissions, templated hypothesis creation where the thesis text field is optional in the UI but required by the registry, or test fixtures missing the thesis key.

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/023eaa494e88b4db. Report an issue: GitHub.