denoland/deno · error
Invalid value for OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PRE
Error message
Invalid value for OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE: {} What it means
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE controls metrics temporality. The value is lowercased (casing is free) but NOT trimmed, and accepted names are only `cumulative` (default when unset), `delta` and `lowmemory`. Anything else fails telemetry init.
Source
Thrown at ext/telemetry/lib.rs:1311
format!("{}-{}", rt_config.runtime_version, sdk_version),
),
])
.build();
// The OTLP endpoint is automatically picked up from the
// `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable. Additional headers can
// be specified using `OTEL_EXPORTER_OTLP_HEADERS`.
let temporality_preference = sys
.env_var("OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE")
.ok()
.map(|s| s.to_lowercase());
let temporality = match temporality_preference.as_deref() {
None | Some("cumulative") => Temporality::Cumulative,
Some("delta") => Temporality::Delta,
Some("lowmemory") => Temporality::LowMemory,
Some(other) => {
return Err(deno_core::anyhow::anyhow!(
"Invalid value for OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE: {}",
other
));
}
};
let (span_processor, meter_provider, log_processor) = if use_console_exporter
{
let span_exporter = console_exporter::ConsoleSpanExporter::new();
let mut span_processor =
BatchSpanProcessor::builder(span_exporter, OtelSharedRuntime).build();
span_processor.set_resource(&resource);
let metric_exporter =
console_exporter::ConsoleMetricExporter::new(temporality);
let metric_reader = DenoPeriodicReader::new(sys, metric_exporter);
let meter_provider = SdkMeterProvider::builder()
.with_reader(metric_reader)View on GitHub (pinned to 89f33cbef2)
Solutions
- Use exactly `cumulative`, `delta` or `lowmemory` with no extra whitespace
- Check for invisible characters: `printf '%s' "$OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE" | od -c`
- Unset the variable to keep the default cumulative temporality
Example fix
# before — dash spelling, rejected export OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=low-memory # after — exact token export OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=lowmemory
Defensive patterns
Strategy: validation
Validate before calling
t="${OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE:-}"
case "${t,,}" in
""|cumulative|delta|lowmemory) ;;
*) echo "invalid temporality preference: '$t'"; exit 1;;
esac
deno run --unstable-otel main.ts Type guard
const TEMPORALITIES = new Set(["cumulative", "delta", "lowmemory"]);
const isTemporality = (raw: string): boolean => {
const v = raw.toLowerCase();
return v === "" || TEMPORALITIES.has(v);
}; Prevention
- Spell it `lowmemory` — no dash, no underscore
- Casing is ignored but surrounding whitespace is not; trim values in wrappers
- Unset the variable to keep the default cumulative temporality
When it happens
Trigger: Setting the variable to `low-memory`, `low_memory`, `instantaneous`, or `cumulative ` (trailing space/newline) — separators and surrounding whitespace are not normalized.
Common situations: Spec names copied from blog posts that spell it low-memory; trailing whitespace from `export VAR=value ` in scripts; env files with CRLF line endings adding a carriage return.
Related errors
- vsock is not supported on this platform
- invalid vsock addr
- no private key found in OTEL_EXPORTER_OTLP_CLIENT_KEY file
- Env var OTEL_TRACES_SAMPLER specifies an unsupported sampler
- Env var OTEL_EXPORTER_OTLP_PROTOCOL specifies an unsupported
AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16).
Data as JSON: /api/errors/6958384bb9568b8d.
Report an issue: GitHub.