Exception raised when operational data-coverage requirements are violated.
Raised by the guards in spotforecast2_safe.preprocessing.coverage when a freshness, lag, or interior-gap invariant is broken and the pipeline cannot safely produce a forecast.
Inherits from RuntimeError so callers that catch RuntimeError keep working; the dedicated class lets safety-critical callers distinguish coverage violations from generic runtime errors.
Examples
import pandas as pdfrom spotforecast2_safe.exceptions import CoverageErrortry:raise CoverageError("Actual Load is stale: last published 2026-06-10 12:00 UTC")except CoverageError as e:print(type(e).__name__, str(e))assertissubclass(CoverageError, RuntimeError)
CoverageError Actual Load is stale: last published 2026-06-10 12:00 UTC
DataTransformationWarning
exceptions.DataTransformationWarning(message)
Warning for output data in transformed space.
Used to notify that the output data is in the transformed space.
Examples
import warningsfrom spotforecast2_safe.exceptions import DataTransformationWarningwith warnings.catch_warnings(record=True) as caught: warnings.simplefilter("always") warnings.warn("Output is in transformed space.", DataTransformationWarning)assertlen(caught) ==1assertissubclass(caught[0].category, DataTransformationWarning)print(caught[0].category.__name__)
DataTransformationWarning
DataTypeWarning
exceptions.DataTypeWarning(message)
Warning for incompatible data types in exogenous data.
Used to notify there are dtypes in the exogenous data that are not ‘int’, ‘float’, ‘bool’ or ‘category’. Most machine learning models do not accept other data types, therefore the forecaster fit and predict may fail.
Examples
import warningsfrom spotforecast2_safe.exceptions import DataTypeWarningwith warnings.catch_warnings(record=True) as caught: warnings.simplefilter("always") warnings.warn("Exogenous data contains unsupported dtypes.", DataTypeWarning)assertlen(caught) ==1assertissubclass(caught[0].category, DataTypeWarning)print(caught[0].category.__name__)
Warning about implications when using exogenous variables.
Used to notify about important implications when using exogenous variables with models that use a two-step approach (e.g., regression + ARAR).
Examples
import warningsfrom spotforecast2_safe.exceptions import ExogenousInterpretationWarningwith warnings.catch_warnings(record=True) as caught: warnings.simplefilter("always") warnings.warn("Exogenous variables may not be used as expected.", ExogenousInterpretationWarning, )assertlen(caught) ==1assertissubclass(caught[0].category, ExogenousInterpretationWarning)print(caught[0].category.__name__)
ExogenousInterpretationWarning
FeatureOutOfRangeWarning
exceptions.FeatureOutOfRangeWarning(message)
Warning for features out of training range.
Used to notify that a feature is out of the range seen during training.
Examples
import warningsfrom spotforecast2_safe.exceptions import FeatureOutOfRangeWarningwith warnings.catch_warnings(record=True) as caught: warnings.simplefilter("always") warnings.warn("Feature value exceeds training range.", FeatureOutOfRangeWarning)assertlen(caught) ==1assertissubclass(caught[0].category, FeatureOutOfRangeWarning)print(caught[0].category.__name__)
FeatureOutOfRangeWarning
IgnoredArgumentWarning
exceptions.IgnoredArgumentWarning(message)
Warning for ignored arguments.
Used to notify that an argument is ignored when using a method or a function.
Examples
import warningsfrom spotforecast2_safe.exceptions import IgnoredArgumentWarningwith warnings.catch_warnings(record=True) as caught: warnings.simplefilter("always") warnings.warn("Argument 'x' is ignored in this context.", IgnoredArgumentWarning)assertlen(caught) ==1assertissubclass(caught[0].category, IgnoredArgumentWarning)print(caught[0].category.__name__)
IgnoredArgumentWarning
InputTypeWarning
exceptions.InputTypeWarning(message)
Warning for inefficient input format.
Used to notify that input format is not the most efficient or recommended for the forecaster.
Examples
import warningsfrom spotforecast2_safe.exceptions import InputTypeWarningwith warnings.catch_warnings(record=True) as caught: warnings.simplefilter("always") warnings.warn("Input format is not optimal for this forecaster.", InputTypeWarning )assertlen(caught) ==1assertissubclass(caught[0].category, InputTypeWarning)print(caught[0].category.__name__)
InputTypeWarning
LeakageError
exceptions.LeakageError()
Exception raised when forbidden columns are detected in model inputs.
Raised by spotforecast2_safe.multitask.guards.assert_no_leakage when a forbidden column name appears in the training frame, the selected exogenous feature set, or the fitted model’s feature list.
Inherits from RuntimeError so callers that catch RuntimeError keep working; the dedicated class lets safety-critical callers distinguish data-governance violations from generic runtime errors.
Examples
from spotforecast2_safe.exceptions import LeakageErrortry:raise LeakageError("Forbidden column 'Forecasted Load' found in training frame" )except LeakageError as e:print(type(e).__name__, str(e))assertissubclass(LeakageError, RuntimeError)
LeakageError Forbidden column 'Forecasted Load' found in training frame
LongTrainingWarning
exceptions.LongTrainingWarning(message)
Warning for potentially long training processes.
Used to notify that a large number of models will be trained and the the process may take a while to run.
Examples
import warningsfrom spotforecast2_safe.exceptions import LongTrainingWarningwith warnings.catch_warnings(record=True) as caught: warnings.simplefilter("always") warnings.warn("Training may take a long time.", LongTrainingWarning)assertlen(caught) ==1assertissubclass(caught[0].category, LongTrainingWarning)print(caught[0].category.__name__)
LongTrainingWarning
MissingExogWarning
exceptions.MissingExogWarning(message)
Warning for missing exogenous variables.
Used to indicate that there are missing exogenous variables in the data. Most machine learning models do not accept missing values, so the Forecaster’s fit' andpredict’ methods may fail.
Used to indicate that there are missing values in the data. This warning occurs when the input data contains missing values, or the training matrix generates missing values. Most machine learning models do not accept missing values, so the Forecaster’s fit' andpredict’ methods may fail.
import warningsfrom spotforecast2_safe.exceptions import MissingValuesWarningwith warnings.catch_warnings(record=True) as caught: warnings.simplefilter("always") warnings.warn("Missing values detected in input data.", MissingValuesWarning)assertlen(caught) ==1assertissubclass(caught[0].category, MissingValuesWarning)print(caught[0].category.__name__)
MissingValuesWarning
NotFittedError
exceptions.NotFittedError()
Exception class to raise if estimator is used before fitting.
This class inherits from both ValueError and AttributeError to help with exception handling and backward compatibility.
Examples
from spotforecast2_safe.exceptions import NotFittedErrortry:raise NotFittedError("Forecaster not fitted")except NotFittedError as e:print(type(e).__name__, str(e))assertissubclass(NotFittedError, ValueError)assertissubclass(NotFittedError, AttributeError)
NotFittedError Forecaster not fitted
OneStepAheadValidationWarning
exceptions.OneStepAheadValidationWarning(message)
Warning for one-step-ahead validation usage.
Used to notify that the one-step-ahead validation is being used.
Exception raised when building a prediction package fails.
Raised by ForecasterRecursiveModel.package_prediction() (and propagated by callers such as manager.predictor.get_model_prediction()) when the underlying prediction pipeline cannot produce a complete result. Inherits from RuntimeError so callers that catch RuntimeError keep working; the dedicated class lets safety-critical callers distinguish a prediction-pipeline failure from generic runtime errors.
Examples
from spotforecast2_safe.exceptions import PredictionPackageErrortry:raise PredictionPackageError("Predict step returned no rows")except PredictionPackageError as e:print(type(e).__name__, str(e))assertissubclass(PredictionPackageError, RuntimeError)
PredictionPackageError Predict step returned no rows
ResidualsUsageWarning
exceptions.ResidualsUsageWarning(message)
Warning for incorrect residuals usage.
Used to notify that a residual are not correctly used in the probabilistic forecasting process.
Examples
import warningsfrom spotforecast2_safe.exceptions import ResidualsUsageWarningwith warnings.catch_warnings(record=True) as caught: warnings.simplefilter("always") warnings.warn("Residuals are not properly used.", ResidualsUsageWarning)assertlen(caught) ==1assertissubclass(caught[0].category, ResidualsUsageWarning)print(caught[0].category.__name__)
ResidualsUsageWarning
SaveLoadSkforecastWarning
exceptions.SaveLoadSkforecastWarning(message)
Warning for save/load operations.
Used to notify any issues that may arise when saving or loading a forecaster.
Examples
import warningsfrom spotforecast2_safe.exceptions import SaveLoadSkforecastWarningwith warnings.catch_warnings(record=True) as caught: warnings.simplefilter("always") warnings.warn("Issues detected when saving forecaster.", SaveLoadSkforecastWarning )assertlen(caught) ==1assertissubclass(caught[0].category, SaveLoadSkforecastWarning)print(caught[0].category.__name__)
SaveLoadSkforecastWarning
SpotforecastVersionWarning
exceptions.SpotforecastVersionWarning(message)
Warning for version mismatch.
Used to notify that the version installed in the environment differs from the version used to initialize the forecaster.
Exception raised when physically-impossible target corruption is detected.
Raised by spotforecast2_safe.preprocessing.target_corruption.apply_target_corruption_policy when target_corruption_policy="abort" and the detector fires, or when the "heal" policy is requested but cannot be applied safely (e.g. the corrupt span touches the anchor zone, or exceeds the heal budget).
Inherits from RuntimeError so callers that catch RuntimeError keep working; the dedicated class lets safety-critical callers distinguish target-corruption aborts from generic runtime errors.
Examples
from spotforecast2_safe.exceptions import TargetCorruptionErrortry:raise TargetCorruptionError("Corrupt target tail detected")except TargetCorruptionError as e:print(type(e).__name__, str(e))assertissubclass(TargetCorruptionError, RuntimeError)
import warningsfrom spotforecast2_safe.exceptions import ( MissingValuesWarning, set_warnings_style,)# Activate the custom box-formatted handler, then emit one warning.set_warnings_style("skforecast")with warnings.catch_warnings(record=True) as caught: warnings.simplefilter("always") warnings.warn("Missing values in test data.", MissingValuesWarning)# Restore default style so subsequent examples are unaffected.set_warnings_style("default")assertlen(caught) ==1print("handler demo: warning category =", caught[0].category.__name__)