nautechsystems/nautilus_trader · error · anyhow::Error
Composite bar types are not supported for `request_bars`, wa
Error message
Composite bar types are not supported for `request_bars`, was {bar_type}; request aggregation via the `bar_types` params instead What it means
`DataActor.request_bars` only accepts standard bar types; `anyhow::ensure!(bar_type.is_standard(), ...)` rejects composite bar types because historical bar requests must go to an external data client with an aggregatable spec, while composite bars are aggregated internally. The message tells you to request the base (standard) bars via the `bar_types` parameter and let internal aggregation build the composite bars instead.
Source
Thrown at crates/common/src/actor/data_actor.rs:5670
/// Requests bars for the actor.
///
/// # Errors
///
/// Returns an error if input parameters are invalid.
#[expect(clippy::too_many_arguments)]
pub fn request_bars(
&self,
bar_type: BarType,
start: Option<Timestamp>,
end: Option<Timestamp>,
limit: Option<NonZeroUsize>,
client_id: Option<ClientId>,
params: Option<Params>,
handler: ShareableMessageHandler,
) -> anyhow::Result<UUID4> {
self.check_registered();
anyhow::ensure!(
bar_type.is_standard(),
"Composite bar types are not supported for `request_bars`, was {bar_type}; \
request aggregation via the `bar_types` params instead",
);
let now = self.clock_ref().utc_now();
check_timestamps(now, start, end)?;
let request_id = UUID4::new();
let command = RequestCommand::Bars(RequestBars {
bar_type,
start,
end,
limit,
client_id,
request_id,
ts_init: now.into(),
params,View on GitHub (pinned to 18893faf8b)
Solutions
- Request the underlying standard bar type in `request_bars` instead of the composite bar type.
- Pass the desired composite/aggregated bar types via the `bar_types` parameter so internal aggregation is used.
- Ensure the BarType is created with a standard spec and external aggregation source (e.g. `BarType::new(instrument_id, spec, AggregationSource::External)`).
Example fix
// before let composite = BarType::new(instrument_id, spec_internal, AggregationSource::Internal); self.request_bars(composite); // after let standard = BarType::new(instrument_id, spec, AggregationSource::External); self.request_bars(standard); // pass composite types via `bar_types` param for aggregation
Defensive patterns
Strategy: validation
Validate before calling
python
if not bar_type.is_standard():
raise ValueError(
f"{bar_type} is composite; request the standard bar type and aggregate via bar_types param"
)
actor.request_bars(standard_bar_type, bar_types=[bar_type]) Type guard
python
def is_standard_bar_type(bar_type: BarType) -> bool:
return bar_type.is_standard() Try / catch
python
try:
await self.request_bars(bar_type)
except Exception as e:
if "Composite bar types are not supported" in str(e):
base = BarType.from_str(str(bar_type).split("*")[0]) # request the standard base
await self.request_bars(base, bar_types=[bar_type])
else:
raise Prevention
- Always build request_bars arguments with AggregationSource::External / standard specs.
- Keep internally aggregated (composite) bar types for subscribe/handler paths, not request paths.
- Use BarType::from_str only with standard-format strings for requests.
- Add an is_standard() assertion in helpers that wrap request_bars.
- Review the DataActor docs distinguishing historical requests from internal aggregation.
When it happens
Trigger: Calling an actor's `request_bars` with a `BarType` constructed with aggregation source/internal composite semantics (e.g. `BarType::new(..., AggregationSource::Internal)` or a composite spec) rather than a standard externally-sourced bar type.
Common situations: Building bar types with `BarType.from_str` strings containing composite/internal markers and passing them to `request_bars`; confusing `request_bars` (historical data from a client) with subscribing to internally aggregated composite bars; porting code that subscribed to composite bars and assuming request works the same way.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Unsupported bar specification for AX: {step}-{:?}
- Bybit only supports 1 WEEK interval bars
- Bybit only supports 1 MONTH interval bars
- Bybit does not support {aggregation:?} bars
- Deribit does not support resolution '{resolution}'. Supporte
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/8105ea4ef8c26b07.
Report an issue: GitHub.