linera-io/linera-protocol · error

End timestamp before 1970

Error message

End timestamp before 1970

What it means

When starting the faucet with --limit-rate-until, the CLI converts the chrono DateTime to microseconds since the Unix epoch with u64::try_from(et.timestamp_micros()). If the timestamp is before 1970-01-01, timestamp_micros() is negative, the conversion fails, and .expect("End timestamp before 1970") panics while building the FaucetConfig.

Source

Thrown at linera-service/src/cli/main.rs:1450

                config,
                storage_path,
                max_batch_size,
            } => {
                let genesis_config = wallet.genesis_config().clone();

                let context = options
                    .create_client_context(storage, wallet, keystore)
                    .await?;

                let chain_id = if let Some(chain_id) = chain_id {
                    chain_id
                } else {
                    context.first_non_admin_chain().await?
                };
                info!("Starting faucet service using chain {}", chain_id);
                let end_timestamp = limit_rate_until.map_or_else(Timestamp::now, |et| {
                    let micros =
                        u64::try_from(et.timestamp_micros()).expect("End timestamp before 1970");
                    Timestamp::from(micros)
                });

                let config = FaucetConfig {
                    port,
                    #[cfg(with_metrics)]
                    metrics_port,
                    chain_id,
                    initial_claim_amount: amount,
                    daily_claim_amount,
                    end_timestamp,
                    genesis_config: Arc::new(genesis_config),
                    chain_listener_config: config,
                    storage_path,
                    max_batch_size,
                    enable_memory_profiling: options.enable_memory_profiling(),
                };
                let faucet = FaucetService::new(config, context).await?;

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. Use a future date after 1970, ideally well in the future: --limit-rate-until '2027-01-01T00:00:00Z'
  2. If the rate limit is not needed, omit --limit-rate-until (it defaults to Timestamp::now)
  3. Validate the date in your deployment script: reject anything whose year is < 1970 before invoking the faucet

Example fix

# before
linera faucet ... --limit-rate-until 1969-12-31T23:59:59Z

# after
linera faucet ... --limit-rate-until 2027-01-01T00:00:00Z
Defensive patterns

Strategy: validation

Validate before calling

# Reject pre-epoch dates before starting the faucet.
if [ -n "$LIMIT_RATE_UNTIL" ]; then
  epoch=$(date -d "$LIMIT_RATE_UNTIL" +%s 2>/dev/null || echo -1)
  [ "$epoch" -gt 0 ] || { echo "--limit-rate-until must be after 1970" >&2; exit 1; }
fi

Prevention

When it happens

Trigger: Passing --limit-rate-until with a date before the Unix epoch (year < 1970), e.g. a mis-typed year like 1969, a zero/empty date parsed as epoch-minus, or a timezone miscalculation that lands the instant pre-1970.

Common situations: Typo'd ISO dates (1969 vs 2026); scripts building timestamps from signed deltas that go negative; systems with a wrong clock or locale parsing that yields a pre-epoch DateTime.

Related errors


AI-assisted analysis of linera-io/linera-protocol@6c226ddcb3 (2026-08-22). Data as JSON: /api/errors/fa27c3b44674c07f. Report an issue: GitHub.