{"record":{"id":"b1597678875a188e","repo":"influxdata/influxdb","slug":"from-hex-error-0","errorCode":null,"errorMessage":"from hex error: {0}","messagePattern":"from hex error: (.+?)","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"influxdb3_server/src/lib.rs","lineNumber":78,"sourceCode":"\n#[derive(Debug, Error)]\npub enum Error {\n    #[error(\"hyper error: {0}\")]\n    Hyper(#[from] hyper::Error),\n\n    #[error(\"http error: {0}\")]\n    Http(#[from] Box<http::Error>),\n\n    #[error(\"database not found {db_name}\")]\n    DatabaseNotFound { db_name: String },\n\n    #[error(\"datafusion error: {0}\")]\n    DataFusion(#[from] datafusion::error::DataFusionError),\n\n    #[error(\"influxdb3_write error: {0}\")]\n    InfluxDB3Write(#[from] influxdb3_write::Error),\n\n    #[error(\"from hex error: {0}\")]\n    FromHex(#[from] hex::FromHexError),\n\n    #[error(\"io error: {0}\")]\n    Io(#[from] std::io::Error),\n\n    #[error(\"tls config error: {0}\")]\n    TlsConfig(String),\n\n    #[error(\"rustls error: {0}\")]\n    Rustls(#[from] rustls::Error),\n}\n\npub type Result<T, E = Error> = std::result::Result<T, E>;\n\n#[derive(Debug, Clone)]\npub struct CommonServerState {\n    catalog: Arc<Catalog>,\n    metrics: Arc<metric::Registry>,","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_server/src/lib.rs#L60-L96","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Inspect the token/identifier string and remove any whitespace, quotes, or truncation before use","Verify the string is pure hexadecimal ([0-9a-fA-F]) with an even number of characters","Regenerate the token from the server instead of hand-editing an existing one","Confirm you are using the correct encoding (hex, not base64) for the field in question"],"exampleFix":"// before\nlet token = \"my-token abc\"; // spaces and non-hex chars\n// after\nlet token = \"a1b2c3d4\"; // pure even-length hex\nassert!(hex::decode(token).is_ok());","handlingStrategy":"validation","validationCode":"fn is_valid_hex(s: &str) -> bool {\n    !s.is_empty() && s.len() % 2 == 0 && s.chars().all(|c| c.is_ascii_hexdigit())\n}","typeGuard":null,"tryCatchPattern":"match server_result {\n    Err(influxdb3_server::Error::FromHex(e)) => eprintln!(\"bad hex token: {e}\"),\n    Err(e) => eprintln!(\"server error: {e}\"),\n    Ok(v) => handle(v),\n}","preventionTips":["Copy tokens programmatically rather than by hand to avoid truncation","Strip whitespace/quotes from tokens read from env vars or config","Sanity-check with hex::decode before sending identifiers to the server","Never hand-edit generated tokens; regenerate instead"],"tags":["influxdb3","hex","encoding","token"],"backgroundTag":"invalid-argument-format","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}