influxdata/influxdb · critical

Could not find user's home directory

Error message

Could not find user's home directory

What it means

A runtime panic in `influxdb3_clap_blocks::object_store::default_data_dir`. When no explicit data directory is configured, the code derives a default from the user's home directory via the `home` crate and unwraps with `.expect(...)`. If the OS cannot determine the home directory (no HOME env var on Unix, or the lookup fails), the process panics with this message while parsing CLI arguments.

Solutions

  1. Pass an explicit data directory flag (e.g. `--data-dir /var/lib/influxdb3`) so the default lookup never runs.
  2. Set the HOME environment variable to a writable directory before launching the binary.
  3. Fix the service/container environment so the runtime user has a valid home directory.

Example fix

// before (env: no HOME)
influxdb3 serve

// after
HOME=/var/lib/influxdb3 influxdb3 serve --data-dir /var/lib/influxdb3
Defensive patterns

Strategy: validation

Validate before calling

#!/bin/sh
if [ -z "$HOME" ]; then echo "HOME is unset; pass --data-dir explicitly" >&2; exit 1; fi

Prevention

When it happens

Trigger: Running an influxdb3 binary without `--data-dir` (or equivalent) while the process has no resolvable home directory — e.g. HOME unset, running as a system service with a minimal environment, or a container running as a non-existent user.

Common situations: Docker/Kubernetes containers or systemd units with a scrubbed environment, CI jobs running as uid without passwd entry, or a user account with no home directory set.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at influxdb3_clap_blocks/src/object_store.rs:100

        path: PathBuf,
        source: object_store::Error,
    },
}

/// The AWS region to use for Amazon S3 based object storage if none is
/// specified.
pub const FALLBACK_AWS_REGION: &str = "us-east-1";
pub const DEFAULT_DATA_DIRECTORY_NAME: &str = ".influxdb";

/// A `clap` `value_parser` which returns `None` when given an empty string and
/// `Some(NonEmptyString)` otherwise.
fn parse_optional_string(s: &str) -> Result<Option<NonEmptyString>, Infallible> {
    Ok(NonEmptyString::new(s.to_string()).ok())
}

fn default_data_dir() -> OsString {
    home::home_dir()
        .expect("Could not find user's home directory")
        .join(DEFAULT_DATA_DIRECTORY_NAME)
        .into_os_string()
}

/// Endpoint for S3 & Co.
///
/// This is a [`Url`] without a trailing slash.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Endpoint(String);

impl std::fmt::Display for Endpoint {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        self.0.fmt(f)
    }
}

impl From<Endpoint> for String {
    fn from(value: Endpoint) -> Self {

View on GitHub (pinned to 06200ef96b)