ZhuLinsen/daily_stock_analysis · warning · DecisionSignalUnsupportedReportTypeError
unsupported_report_type
unsupported_report_type
Error message
source report is not a stock analysis report
What it means
_build_candidate rejects source reports whose report_type is 'market_review' by raising DecisionSignalUnsupportedReportTypeError (code=unsupported_report_type). Market reviews cover the whole market and have no single stock decision, so they cannot produce a per-stock decision signal.
Source
Thrown at src/services/decision_signal_reassess_service.py:208
"stop_loss": candidate.stop_loss,
"target_price": candidate.target_price,
"invalidation": candidate.invalidation,
"reason": candidate.reason,
"risk_summary": candidate.risk_summary,
"watch_conditions": candidate.watch_conditions,
"metadata": metadata,
"report_language": raw_result.get("report_language"),
}
def _build_candidate(
record: AnalysisHistory,
raw_result: Mapping[str, Any],
context_snapshot: Mapping[str, Any],
) -> DecisionSignalCandidate:
report_type = str(getattr(record, "report_type", "") or "").strip().lower()
if report_type == "market_review":
raise DecisionSignalUnsupportedReportTypeError("source report is not a stock analysis report")
raw_code = str(getattr(record, "code", "") or "").strip()
market = _infer_market(raw_code)
if not raw_code or not market:
raise DecisionSignalUnsupportedReportSnapshotError("source report has no supported stock identity")
dashboard = _as_mapping(raw_result.get("dashboard"))
score = _effective_signal_score(
_score_from_value(_first_present(raw_result.get("sentiment_score"), getattr(record, "sentiment_score", None))),
dashboard=dashboard,
)
raw_action = normalize_decision_action(raw_result.get("action")) or normalize_decision_action(
_first_present(raw_result.get("operation_advice"), getattr(record, "operation_advice", None))
)
guardrail_reason = _extract_guardrail_reason(raw_result, score=score, raw_action=raw_action)
action_fields = build_action_fields(
operation_advice=_first_present(
raw_result.get("operation_advice"),View on GitHub (pinned to 5159bd72e8)
Solutions
- Filter history to individual stock analyses before offering reassess: exclude report_type == 'market_review'.
- Use the stock-report list endpoint to select the source report id.
- Catch DecisionSignalUnsupportedReportTypeError in batch loops and skip such reports.
Example fix
# before
result = service.reassess(source_report_id=any_id, decision_profile="balanced")
# after
record = db.get_analysis_history_by_id(any_id)
if str(record.report_type or "").strip().lower() == "market_review":
raise ValueError("pick a stock analysis report, not a market review")
result = service.reassess(source_report_id=any_id, decision_profile="balanced") Defensive patterns
Strategy: type-guard
Validate before calling
report_type = str(getattr(record, "report_type", "") or "").strip().lower()
if report_type == "market_review":
return JSONResponse(status_code=422, content={"error": "unsupported_report_type", "message": "market reviews cannot produce stock signals"})
result = service.reassess(source_report_id=rid, decision_profile=profile) Type guard
def isStockAnalysisReport(record) -> bool:
return str(getattr(record, "report_type", "") or "").strip().lower() != "market_review" Try / catch
from src.services.decision_signal_reassess_service import DecisionSignalUnsupportedReportTypeError
try:
result = service.reassess(source_report_id=rid, decision_profile=profile, persist=persist)
except DecisionSignalUnsupportedReportTypeError:
return JSONResponse(status_code=422, content={"error": "unsupported_report_type", "message": "source report is not a stock analysis report"}) Prevention
- Hide the reassess action for market-review entries in the UI.
- Batch loops: skip report_type == 'market_review' before calling reassess.
- Compare report_type case-insensitively — the service lowercases it.
When it happens
Trigger: Calling reassess (even preview) with the id of a market-review report — record.report_type == 'market_review' (case-insensitive).
Common situations: Frontend reassess button enabled on market-review entries in the history list; batch jobs iterating all history without filtering report_type; users grabbing the newest history id which happens to be a market review.
Related errors
- {field_name} must be an integer
- {field_name} must be positive
- source_report_not_found
- guardrail_blocked
- unsupported_report_snapshot
AI-assisted analysis of ZhuLinsen/daily_stock_analysis@5159bd72e8 (2026-08-15).
Data as JSON: /api/errors/25aa29cf0a0081a0.
Report an issue: GitHub.