{"record":{"id":"b33cf73fb194fec5","repo":"google-research/timesfm","slug":"continuous-quantile-head-is-not-supported-for-hori","errorCode":null,"errorMessage":"Continuous quantile head is not supported for horizons > {self.model.os}.","messagePattern":"Continuous quantile head is not supported for horizons > (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/timesfm/timesfm_2p5/timesfm_2p5_flax.py","lineNumber":539,"sourceCode":"        new_context := math.ceil(fc.max_context / self.model.p) * self.model.p,\n      )\n      fc = dataclasses.replace(fc, max_context=new_context)\n    if fc.max_horizon % self.model.o != 0:\n      logging.info(\n        \"When compiling, max horizon needs to be multiple of the output patch\"\n        \" size %d. Using max horizon = %d instead.\",\n        self.model.o,\n        new_horizon := math.ceil(fc.max_horizon / self.model.o) * self.model.o,\n      )\n      fc = dataclasses.replace(fc, max_horizon=new_horizon)\n    if fc.max_context + fc.max_horizon > self.model.config.context_limit:\n      raise ValueError(\n        \"Context + horizon must be less than the context limit.\"\n        f\" {fc.max_context} + {fc.max_horizon} >\"\n        f\" {self.model.config.context_limit}.\"\n      )\n    if fc.use_continuous_quantile_head and (fc.max_horizon > self.model.os):\n      raise ValueError(\n        f\"Continuous quantile head is not supported for horizons > {self.model.os}.\"\n      )\n\n    self.forecast_config = fc\n    self.model.compile(\n      context=self.forecast_config.max_context,\n      horizon=self.forecast_config.max_horizon,\n      per_core_batch_size=fc.per_core_batch_size,\n    )\n    self.per_core_batch_size = self.forecast_config.per_core_batch_size\n    self.num_devices = self.model.num_devices\n    self.global_batch_size = (\n      self.forecast_config.per_core_batch_size * self.model.num_devices\n    )\n\n    def compiled_decode_kernel(fc, horizon, inputs, masks):\n      inputs = jnp.array(inputs, dtype=jnp.float32)\n      masks = jnp.array(masks, dtype=jnp.bool)","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/google-research/timesfm/blob/331c6d33cb1ac2611de3056d0ac7164aab6301eb/src/timesfm/timesfm_2p5/timesfm_2p5_flax.py#L521-L557","documentation":"The continuous quantile head (used when `use_continuous_quantile_head=True`) can only emit quantiles up to the model's trained output horizon `self.model.os`. If the compiled `max_horizon` exceeds `os`, quantile outputs beyond that are undefined, so compile() raises ValueError. This is a model-capability boundary, not a generic config error.","triggerScenarios":"Calling `model.compile()` with `ForecastConfig(use_continuous_quantile_head=True, max_horizon=os+1 or larger)`; requesting long-horizon continuous quantiles on a model variant whose quantile head supports only os steps.","commonSituations":"Enabling the quantile head to get smooth quantile forecasts but also needing a long horizon; copying a config that used a bigger model variant with a larger os; not rounding max_horizon down (note compile rounds max_horizon up to patch multiples before this check).","solutions":["Reduce `max_horizon` to at most `model.os` when using the continuous quantile head","Set `use_continuous_quantile_head=False` if you need longer horizons (quantiles come from the standard quantiles output instead)","Check `model.os` for your checkpoint before configuring"],"exampleFix":"// before\nmodel.compile(forecast_config=ForecastConfig(max_context=512, max_horizon=256, use_continuous_quantile_head=True))\n// after\nmodel.compile(forecast_config=ForecastConfig(max_context=512, max_horizon=model.os, use_continuous_quantile_head=True))","handlingStrategy":"validation","validationCode":"if fc.use_continuous_quantile_head and fc.max_horizon > model.os:\n    fc = dataclasses.replace(fc, max_horizon=model.os)  # or disable the quantile head\nmodel.compile(forecast_config=fc)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check model.os before enabling use_continuous_quantile_head","Cap max_horizon at model.os whenever the quantile head is on","Pin one config builder per model variant so capability limits are encoded once"],"tags":["python","validation","quantile","model-capability"],"backgroundTag":"horizon-exceeds-limit","analyzedSha":"331c6d33cb1ac2611de3056d0ac7164aab6301eb","analyzedAt":"2026-08-29T01:04:23.138Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}