influxdata/influxdb · error · Error

from hex error

Error message

from hex error: {0}

What it means

The server converts hex decoding failures (hex::FromHexError) into this variant via #[from]. In the InfluxDB3 server codebase, hex decoding is used when parsing token/identifier strings that are expected to be hexadecimal (e.g. parsing UUID or token components into byte arrays). If a caller supplies a string that is not valid hex, or has an odd length, this error is returned.

Solutions

  1. Inspect the token/identifier string and remove any whitespace, quotes, or truncation before use
  2. Verify the string is pure hexadecimal ([0-9a-fA-F]) with an even number of characters
  3. Regenerate the token from the server instead of hand-editing an existing one
  4. Confirm you are using the correct encoding (hex, not base64) for the field in question

Example fix

// before
let token = "my-token abc"; // spaces and non-hex chars
// after
let token = "a1b2c3d4"; // pure even-length hex
assert!(hex::decode(token).is_ok());
Defensive patterns

Strategy: validation

Validate before calling

fn is_valid_hex(s: &str) -> bool {
    !s.is_empty() && s.len() % 2 == 0 && s.chars().all(|c| c.is_ascii_hexdigit())
}

Try / catch

match server_result {
    Err(influxdb3_server::Error::FromHex(e)) => eprintln!("bad hex token: {e}"),
    Err(e) => eprintln!("server error: {e}"),
    Ok(v) => handle(v),
}

Prevention

When it happens

Trigger: Supplying an API token or identifier containing non-hexadecimal characters, or with an odd number of hex digits, where the server parses it into bytes via hex::decode (e.g. admin token handling or identifier parsing in HTTP handlers).

Common situations: Copying an InfluxDB token with truncation or whitespace; hand-editing token strings; mixing base64 or other encodings where hex is expected; passing a placeholder value like 'your-token-here' which contains invalid hex characters.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/b1597678875a188e. Report an issue: GitHub.

Appendix: source

Thrown at influxdb3_server/src/lib.rs:78

#[derive(Debug, Error)]
pub enum Error {
    #[error("hyper error: {0}")]
    Hyper(#[from] hyper::Error),

    #[error("http error: {0}")]
    Http(#[from] Box<http::Error>),

    #[error("database not found {db_name}")]
    DatabaseNotFound { db_name: String },

    #[error("datafusion error: {0}")]
    DataFusion(#[from] datafusion::error::DataFusionError),

    #[error("influxdb3_write error: {0}")]
    InfluxDB3Write(#[from] influxdb3_write::Error),

    #[error("from hex error: {0}")]
    FromHex(#[from] hex::FromHexError),

    #[error("io error: {0}")]
    Io(#[from] std::io::Error),

    #[error("tls config error: {0}")]
    TlsConfig(String),

    #[error("rustls error: {0}")]
    Rustls(#[from] rustls::Error),
}

pub type Result<T, E = Error> = std::result::Result<T, E>;

#[derive(Debug, Clone)]
pub struct CommonServerState {
    catalog: Arc<Catalog>,
    metrics: Arc<metric::Registry>,

View on GitHub (pinned to 06200ef96b)