{"record":{"id":"12c85e52ef1c6807","repo":"influxdata/influxdb","slug":"could-not-find-user-s-home-directory","errorCode":null,"errorMessage":"Could not find user's home directory","messagePattern":"Could not find user's home directory","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"influxdb3_clap_blocks/src/object_store.rs","lineNumber":100,"sourceCode":"        path: PathBuf,\n        source: object_store::Error,\n    },\n}\n\n/// The AWS region to use for Amazon S3 based object storage if none is\n/// specified.\npub const FALLBACK_AWS_REGION: &str = \"us-east-1\";\npub const DEFAULT_DATA_DIRECTORY_NAME: &str = \".influxdb\";\n\n/// A `clap` `value_parser` which returns `None` when given an empty string and\n/// `Some(NonEmptyString)` otherwise.\nfn parse_optional_string(s: &str) -> Result<Option<NonEmptyString>, Infallible> {\n    Ok(NonEmptyString::new(s.to_string()).ok())\n}\n\nfn default_data_dir() -> OsString {\n    home::home_dir()\n        .expect(\"Could not find user's home directory\")\n        .join(DEFAULT_DATA_DIRECTORY_NAME)\n        .into_os_string()\n}\n\n/// Endpoint for S3 & Co.\n///\n/// This is a [`Url`] without a trailing slash.\n#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]\npub struct Endpoint(String);\n\nimpl std::fmt::Display for Endpoint {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        self.0.fmt(f)\n    }\n}\n\nimpl From<Endpoint> for String {\n    fn from(value: Endpoint) -> Self {","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_clap_blocks/src/object_store.rs#L82-L118","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass an explicit data directory flag (e.g. `--data-dir /var/lib/influxdb3`) so the default lookup never runs.","Set the HOME environment variable to a writable directory before launching the binary.","Fix the service/container environment so the runtime user has a valid home directory."],"exampleFix":"// before (env: no HOME)\ninfluxdb3 serve\n\n// after\nHOME=/var/lib/influxdb3 influxdb3 serve --data-dir /var/lib/influxdb3","handlingStrategy":"validation","validationCode":"#!/bin/sh\nif [ -z \"$HOME\" ]; then echo \"HOME is unset; pass --data-dir explicitly\" >&2; exit 1; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass an explicit --data-dir in services, containers, and CI.","Ensure HOME is set in container images and systemd units (Environment=HOME=...).","Run daemons under a user account with a valid home directory.","Test launches in a scrubbed-env shell to catch missing defaults before deployment."],"tags":["panic","cli","configuration","home-directory","environment"],"backgroundTag":"missing-env-var","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"}