vectordotdev/vector · error
Env var DD_ORIGIN_PRODUCT must be an unsigned 32 bit…
Error message
Env var DD_ORIGIN_PRODUCT must be an unsigned 32 bit integer.
What it means
At compile/first-use time, Vector reads the DD_ORIGIN_PRODUCT environment variable (baked in via option_env!) and parses it as u32 for Datadog metrics 'origin product' attribution. If set at build time to a value that is not an unsigned 32-bit integer, the LazyLock panics.
Solutions
- Rebuild with DD_ORIGIN_PRODUCT set to a valid u32 (e.g. 14)
- Check for quotes/whitespace in the env var in CI
- Clear DD_ORIGIN_PRODUCT to fall back to the default of 14
Example fix
// before (build env) DD_ORIGIN_PRODUCT="big" // after DD_ORIGIN_PRODUCT=14
Defensive patterns
Strategy: validation
Validate before calling
// build-time check (shell)
case "$DD_ORIGIN_PRODUCT" in ''|*[!0-9]*) echo 'DD_ORIGIN_PRODUCT must be a u32'; exit 1;; esac
awk "BEGIN{exit !($DD_ORIGIN_PRODUCT <= 4294967295)}" || { echo 'out of u32 range'; exit 1; } Type guard
fn is_valid_u32(s: &str) -> bool { s.parse::<u32>().is_ok() } Try / catch
let p = p.parse::<u32>().map_err(|_| anyhow!("DD_ORIGIN_PRODUCT must be an unsigned 32 bit integer"))?; Prevention
- Validate build env vars in CI before compiling
- Avoid quotes/whitespace around numeric env values
- Prefer the default (14) unless Datadog requires otherwise
- Document required build env vars for release engineers
When it happens
Trigger: Building Vector with DD_ORIGIN_PRODUCT set to a non-numeric, negative, or >u32::MAX value; the value is fixed at compile time via option_env! so runtime env changes have no effect.
Common situations: CI build scripts exporting DD_ORIGIN_PRODUCT with quotes, whitespace, or an out-of-range ID; typos in the Datadog product numeric ID.
Understand the failure class
Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.
Related errors
- API key should be only valid ASCII characters
- Could not build Datadog domain regex
- `duration` should be an i64
- `error` should be an i64
- Failed to build Vector for example validation
AI-assisted analysis of vectordotdev/vector@0d4ab78a4f (2026-09-16).
Data as JSON: /api/errors/326fc28f26082e0e.
Report an issue: GitHub.
Appendix: source
Thrown at src/sinks/datadog/metrics/encoder.rs:49
DATADOG_METRIC_RESOURCE_TAG_PREFIX, DatadogMetricType, DatadogPoint, DatadogSeriesMetric,
DatadogSeriesMetricMetadata,
},
sinks::util::{Compression, Compressor, encode_namespace, request_builder::EncodeResult},
};
const SERIES_PAYLOAD_HEADER: &[u8] = b"{\"series\":[";
const SERIES_PAYLOAD_FOOTER: &[u8] = b"]}";
const SERIES_PAYLOAD_DELIMITER: &[u8] = b",";
pub(super) const ORIGIN_CATEGORY_VALUE: u32 = 11;
const DEFAULT_DD_ORIGIN_PRODUCT_VALUE: u32 = 14;
pub(super) static ORIGIN_PRODUCT_VALUE: LazyLock<u32> = LazyLock::new(|| {
option_env!("DD_ORIGIN_PRODUCT")
.map(|p| {
p.parse::<u32>()
.expect("Env var DD_ORIGIN_PRODUCT must be an unsigned 32 bit integer.")
})
.unwrap_or(DEFAULT_DD_ORIGIN_PRODUCT_VALUE)
});
#[derive(Debug, Snafu)]
pub enum EncoderError {
#[snafu(display(
"Invalid metric value '{}' was given; '{}' expected",
metric_value,
expected
))]
InvalidMetric {
expected: &'static str,
metric_value: &'static str,
},
#[snafu(
context(false),View on GitHub (pinned to 0d4ab78a4f)