nautechsystems/nautilus_trader · error · anyhow::Error
Invalid Hyperliquid bar interval: {s}
Error message
Invalid Hyperliquid bar interval: {s} What it means
FromStr for the Hyperliquid bar-interval enum accepts only the fixed venue strings ('1m','3m','5m','15m','30m','1h','2h','4h','8h','12h','1d','3d', and so on); any other interval string fails to parse into an enum variant.
Source
Thrown at crates/adapters/hyperliquid/src/common/enums.rs:96
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"1m" => Ok(Self::OneMinute),
"3m" => Ok(Self::ThreeMinutes),
"5m" => Ok(Self::FiveMinutes),
"15m" => Ok(Self::FifteenMinutes),
"30m" => Ok(Self::ThirtyMinutes),
"1h" => Ok(Self::OneHour),
"2h" => Ok(Self::TwoHours),
"4h" => Ok(Self::FourHours),
"8h" => Ok(Self::EightHours),
"12h" => Ok(Self::TwelveHours),
"1d" => Ok(Self::OneDay),
"3d" => Ok(Self::ThreeDays),
"1w" => Ok(Self::OneWeek),
"1M" => Ok(Self::OneMonth),
_ => anyhow::bail!("Invalid Hyperliquid bar interval: {s}"),
}
}
}
impl Display for HyperliquidBarInterval {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.as_str())
}
}
/// Represents the order side (Buy or Sell).
#[derive(
Copy,
Clone,
Debug,
Display,
PartialEq,
Eq,View on GitHub (pinned to 18893faf8b)
Solutions
- Use one of Hyperliquid's supported intervals: 1m,3m,5m,15m,30m,1h,2h,4h,8h,12h,1d,3d,1w,1M.
- Normalize/mapping-table your app's intervals to the closest supported Hyperliquid interval.
- Validate the interval string before constructing the request and surface the supported list in your config error.
Example fix
// before
let interval = HyperliquidBarInterval::from_str("2h")?; // not supported
// after
let interval = HyperliquidBarInterval::from_str("1h")?; // valid interval Defensive patterns
Strategy: validation
Validate before calling
const VALID_INTERVALS: &[&str] = &["1m","3m","5m","15m","30m","1h","2h","4h","8h","12h","1d","3d","1w","1M"];
fn valid_interval(s: &str) -> bool { VALID_INTERVALS.contains(&s) } Try / catch
match HyperliquidBarInterval::from_str(s) {
Ok(i) => use_interval(i),
Err(e) => eprintln!("{e}; supported: {VALID_INTERVALS:?}"),
} Prevention
- Store intervals as the enum, not free strings, in config.
- Map external exchange intervals to Hyperliquid's set explicitly.
- Watch the 1m vs 1M (minute vs month) case distinction.
When it happens
Trigger: Calling from_str (or passing an interval string through bar-request config) with a value like "2h", "30m", "1min", or "W" that Hyperliquid does not define.
Common situations: Reusing interval presets from other exchanges (e.g. Binance's 2h/4h... though Hyperliquid has 4h, others like 2h differ); typos or case mistakes such as "1m" vs "1M" (minute vs month).
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Unsupported minute step: {step}
- Unsupported hour step: {step}
- Unsupported day step: {step}
- Unsupported Deribit resolution: {resolution}
- Invalid Hyperliquid symbol format: {symbol}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/432089b915747671.
Report an issue: GitHub.