ZhuLinsen/daily_stock_analysis · warning · DecisionSignalUnsupportedReportSnapshotError

unsupported_report_snapshot

unsupported_report_snapshot

Error message

source report snapshot cannot produce a valid decision signal: {exc}

What it means

During persist, create_history_bound_signal_with_outcome can raise ValueError when the payload built from the source report is not valid (score/action/phase fields etc.); the reassess service wraps it as DecisionSignalUnsupportedReportSnapshotError (code=unsupported_report_snapshot), signaling the report snapshot's data cannot yield a well-formed decision signal.

Source

Thrown at src/services/decision_signal_reassess_service.py:149

        payload = _build_persist_payload(
            record,
            raw_result=raw_result,
            decision_profile=decision_profile_norm,
            candidate=preview_candidate,
            metadata=metadata,
        )
        market_phase_summary = _as_mapping(context_snapshot.get("market_phase_summary"))
        if not market_phase_summary:
            market_phase_summary = _as_mapping(raw_result.get("market_phase_summary"))
        try:
            outcome = self.signal_service.create_history_bound_signal_with_outcome(
                payload,
                history_created_at=getattr(record, "created_at", None),
                market_phase_summary=market_phase_summary,
            )
        except ValueError as exc:
            raise DecisionSignalUnsupportedReportSnapshotError(
                f"source report snapshot cannot produce a valid decision signal: {exc}"
            ) from exc
        return {
            "preview": None,
            "item": outcome.item,
            "created": outcome.created,
            "persist_status": outcome.disposition,
            "warnings": policy.warnings,
            "blocked_reason": None,
        }


def _build_persist_payload(
    record: AnalysisHistory,
    *,
    raw_result: Mapping[str, Any],
    decision_profile: str,
    candidate: DecisionSignalCandidate,

View on GitHub (pinned to 5159bd72e8)

Solutions

  1. Inspect the report's raw_result/context_snapshot for the required fields (dashboard, action, sentiment_score, market_phase_summary).
  2. Choose a recent report generated by the current engine; skip legacy snapshots.
  3. If the report class is needed, fix/normalize its raw_result before reassessing.

Example fix

# before
outcome = service.reassess(source_report_id=legacy_id, decision_profile="balanced", persist=True)

# after
recent = next(r for r in db.list_analysis_history(limit=20) if r.raw_result.get("dashboard"))
outcome = service.reassess(source_report_id=recent.id, decision_profile="balanced", persist=True)
Defensive patterns

Strategy: try-catch

Validate before calling

raw = _parse_mapping(getattr(record, "raw_result", None))
required = ("dashboard", "action")
missing = [k for k in required if k not in raw]
if missing:
    return JSONResponse(status_code=422, content={"error": "unsupported_report_snapshot", "missing": missing})
result = service.reassess(source_report_id=rid, decision_profile=profile, persist=True)

Type guard

def isReassessableSnapshot(raw_result: dict) -> bool:
    return isinstance(raw_result, dict) and "dashboard" in raw_result and raw_result.get("action") is not None

Try / catch

from src.services.decision_signal_reassess_service import DecisionSignalUnsupportedReportSnapshotError

try:
    outcome = service.reassess(source_report_id=rid, decision_profile=profile, persist=True)
except DecisionSignalUnsupportedReportSnapshotError as exc:
    return JSONResponse(status_code=422, content={"error": "unsupported_report_snapshot", "message": str(exc)})

Prevention

When it happens

Trigger: POST reassess persist=true on a legacy report whose raw_result lacks required keys (dashboard/action/score) or carries values the downstream validation rejects (None score, unknown action, malformed market_phase_summary).

Common situations: Old reports written before schema changes; partial/failed analyses saved with raw_result present but incomplete; reports generated by a different engine version.

Related errors


AI-assisted analysis of ZhuLinsen/daily_stock_analysis@5159bd72e8 (2026-08-15). Data as JSON: /api/errors/7c1c6327cde2fdf0. Report an issue: GitHub.