nautechsystems/nautilus_trader · error
Unsupported bar specification for AX
Error message
Unsupported bar specification for AX: {step}-{:?} What it means
TryFrom conversion from a Nautilus bar specification (step + BarAggregation) to the AX adapter's internal bar-agg enum only supports a fixed whitelist (5s/1m/5m/15m/1h/1d). Any other combination hits the catch-all and bails. This is adapter-level input validation, thrown during subscription/config conversion.
Solutions
- Change the bar spec to one of the supported pairs: 5-Second, 1-Minute, 5-Minute, 15-Minute, 1-Hour, or 1-Day
- Aggregate higher/lower timeframe bars downstream in Nautilus instead of asking AX for them
- Add a match arm in enums.rs if the AX API actually supports the desired aggregation
Example fix
// before bar_specs: vec![BarSpecification::new(30, BarAggregation::Minute, PriceType::Last)] // after bar_specs: vec![BarSpecification::new(15, BarAggregation::Minute, PriceType::Last)]
Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED: &[(u64, BarAggregation)] = &[
(5, BarAggregation::Second), (1, BarAggregation::Minute),
(5, BarAggregation::Minute), (15, BarAggregation::Minute),
(1, BarAggregation::Hour), (1, BarAggregation::Day),
];
fn is_supported(step: u64, agg: BarAggregation) -> bool {
SUPPORTED.iter().any(|(s, a)| *s == step && *a == agg)
} Try / catch
match AxBarAgg::try_from(bar_spec) {
Ok(agg) => subscribe(agg),
Err(e) => { log::warn!("{e}; falling back to 1-Minute bars"); subscribe(AxBarAgg::Minutes1) }
} Prevention
- Keep venue bar-spec configs restricted to the documented whitelist per adapter
- Add a startup config check that validates all bar specs against each venue adapter
When it happens
Trigger: Requesting bar subscriptions with aggregations like Second(1), Minute(30), Hour(4), Week, or Tick on the Architect AX adapter; passing a BarAggregation/step pair outside the match arms.
Common situations: Config files requesting e.g. 1-second or 4-hour bars; generic backtest configs reused against AX live nodes; users assuming AX supports all Nautilus aggregations.
Related errors
- AX requires whole contract quantities, was
- bar_type.aggregation_source must be External, was
- Cannot persist bar with composite bar type
- Derive only supports 1 DAY interval bars
- Derive only supports hour intervals 1, 4, 8
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/0c3797ec6802bc46.
Report an issue: GitHub.
Appendix: source
Thrown at crates/adapters/architect_ax/src/common/enums.rs:633
#[serde(rename = "1d")]
#[strum(serialize = "1d")]
Days1,
}
impl TryFrom<&BarSpecification> for AxCandleWidth {
type Error = anyhow::Error;
fn try_from(spec: &BarSpecification) -> Result<Self, Self::Error> {
let step = spec.step.get();
match (step, spec.aggregation) {
(1, BarAggregation::Second) => Ok(Self::Seconds1),
(5, BarAggregation::Second) => Ok(Self::Seconds5),
(1, BarAggregation::Minute) => Ok(Self::Minutes1),
(5, BarAggregation::Minute) => Ok(Self::Minutes5),
(15, BarAggregation::Minute) => Ok(Self::Minutes15),
(1, BarAggregation::Hour) => Ok(Self::Hours1),
(1, BarAggregation::Day) => Ok(Self::Days1),
_ => anyhow::bail!(
"Unsupported bar specification for AX: {step}-{:?}",
spec.aggregation,
),
}
}
}
/// WebSocket market data request type (client to server).
///
/// # References
/// - <https://docs.architect.exchange/api-reference/marketdata/md-ws>
#[derive(
Clone,
Copy,
Debug,
Display,
Eq,
PartialEq,View on GitHub (pinned to 18893faf8b)