Skip to content

Reference

Errors

Errors are product surface: typed, importable one level deep, and written to name the offending source, the rows, both timestamps where temporal, and a concrete fix. This catalog is captured from the installed package’s inheritance tree.

import mostlyright as mr
try:
frame = mr.align(spine, source)
except mr.LeakageError as e:
... # the guard tripped; e names the source, rows, and fix
except mr.ContractError:
... # a frame does not conform to its contract
except mr.NoDataError:
... # nothing came back

mr.LeakageError, mr.ContractError, and mr.NoDataError are importable one deep (the requests.HTTPError convention). Everything below inherits MostlyRightError unless noted.

FamilyMembersRaised when
LeakageLeakageError, OpenMeteoSeamlessLeakageErrorA source row postdates the decision cutoff
ContractContractError, LabelAlignmentError, SchemaValidationError, IssuedAtMissingError, UnitsContractErrorA frame, label, or schema does not conform
No dataNoDataErrorLiveStreamErrorNoLiveDataErrorNoCWOPDataErrorNothing came back, at increasing specificity
AvailabilityDataAvailabilityError, SourceUnavailableError, PayloadTooLargeErrorA source, extra, or payload cannot be served
ProvenanceSourceMismatchErrorTrain/serve source identity diverges
TemporalTemporalDriftErrorClock or timeline inconsistency
DomainMembers
NWPNwpErrorNwpModelNotAvailableError, NwpModelRetiredError, GribIntegrityError, HistoricalDepthError, NoLiveForNwpError, StormNotFoundError
SatelliteSatelliteErrorGoesS3Error, GoesDataCorruptError (→ UnitsContractError), ProductNotRegisteredError, StationOutOfGridError
EconIndicatorNotYetReleasedError, EarningsErrorEarningsFactCorruptError
MarketsPolymarketStrikeError, PolymarketEventError, PolymarketSettlementError, TooEarlyToSettleError, DeferredMarketError

One deliberate exception in markets: KalshiTickerError subclasses ValueError, not MostlyRightError, because a malformed ticker is a caller-input error in the standard Python sense. Catch it separately when parsing user-supplied tickers.

The SDK’s error-copy contract: every user-facing error carries the offending source id, the entity or rows involved, both timestamps where the failure is temporal, and a concrete fix. Example, verbatim shape:

Leakage detected in source 'weather.forecasts.gfs': 3 row(s) carry a
knowledge_time after the spine decision_time cutoff 2025-01-02T00:00:00+00:00.
Fix: filter the source to knowledge_time <= your decision_time before calling
align(), or call mr.provenance(frame) to inspect the offending rows.

Unknown entities fail with a nearest-match hint (unknown entity 'KNYX'; did you mean 'KNYC'?), never fuzzy auto-correction.