HKUDS/Vibe-Trading · error · ValueError
evidence text cannot be empty
Error message
evidence text cannot be empty
What it means
append_evidence strips the evidence text and raises ValueError('evidence text cannot be empty') when nothing remains — an evidence row must carry actual content to be usable in goal audits. The check runs inside a write transaction after the goal is confirmed mutable and IDs resolved.
Source
Thrown at agent/src/goal/store.py:632
goal_id: Goal being mutated.
expected_goal_id: Goal id captured at the start of the agent turn.
evidence: Evidence payload.
Returns:
Persisted evidence record.
Raises:
StaleGoalError: If the expected goal id does not match or goal is not current.
ValueError: If evidence text is empty or references an unknown criterion.
"""
evidence_id = _id("ev")
with self._write_transaction():
goal = self._require_mutable_goal(session_id, goal_id, expected_goal_id)
session_id = goal.session_id
goal_id = goal.goal_id
text = evidence.text.strip()
if not text:
raise ValueError("evidence text cannot be empty")
if evidence.criterion_id is not None:
self._require_criterion(goal.goal_id, evidence.criterion_id)
if evidence.claim_id is not None:
self._require_claim(goal.goal_id, evidence.claim_id)
now = _now_iso()
freshness_status = "fresh" if evidence.data_as_of else "unknown"
verification_status = self._verification_status(evidence)
self._conn.execute(
"""
INSERT INTO goal_evidence (
evidence_id, goal_id, session_id, criterion_id, claim_id,
evidence_type, text, tool_call_id, run_id, source_provider,
source_type, source_uri, symbol_universe_json, benchmark_json,
timeframe, method, assumptions_json, artifact_path,
artifact_hash, retrieved_at, data_as_of, freshness_status,
verification_status, confidence, caveat,
contradicts_claim_ids_json, created_atView on GitHub (pinned to 80ffdda44c)
Solutions
- Ensure evidence.text is a non-blank string before calling append_evidence
- In agent loops, skip logging when the captured output is empty rather than recording it
- Strip and check in the caller: if not text.strip(): return/skip
- If evidence is genuinely empty (e.g. empty command output), record a descriptive placeholder like '(no output)'
Example fix
# before
store.append_evidence(session_id, goal_id, EvidenceRecord(text=" "))
# after
if output.strip():
store.append_evidence(session_id, goal_id, EvidenceRecord(text=output.strip())) Defensive patterns
Strategy: validation
Validate before calling
text = (evidence_text or '').strip()
if not text:
# skip logging instead of raising downstream
logging.debug('skipping empty evidence')
else:
store.append_evidence(session_id, goal_id, EvidenceRecord(text=text)) Type guard
def is_valid_evidence(text: str) -> bool:
return isinstance(text, str) and bool(text.strip()) Try / catch
try:
store.append_evidence(session_id, goal_id, ev)
except ValueError as e:
if 'cannot be empty' in str(e):
pass # intentionally skip blank evidence
else:
raise Prevention
- Strip-and-check evidence text in agent loops before recording
- Skip (don't record) empty tool outputs
- Use a descriptive placeholder like '(no output)' when output is legitimately empty
When it happens
Trigger: Calling append_evidence with evidence.text='' or whitespace-only (' ', '\n'); agent flows (cmd_evidence / add_goal_evidence) forwarding a file read that came back empty or a generated summary that was blank.
Common situations: Automated agents logging evidence from tool output that can be empty; templates producing whitespace-only strings; UI optional textareas submitted empty; tests asserting rejection of blank evidence.
Related errors
- {field_name} cannot be empty
- at least one goal criterion is required
- {name} must be positive
- evidence limit must be positive
- usage deltas must be non-negative
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/f4250fd7809aec87.
Report an issue: GitHub.