{"record":{"id":"1168935476c87785","repo":"linera-io/linera-protocol","slug":"default-wallet-directory-is-not-supported-in-this","errorCode":null,"errorMessage":"Default wallet directory is not supported in this platform: please specify storage and wallet paths","messagePattern":"Default wallet directory is not supported in this platform: please specify storage and wallet paths","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"linera-wallet-json/src/paths.rs","lineNumber":15,"sourceCode":"// Copyright (c) Zefchain Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n//! Default file path resolution for wallet, keystore, and config directory.\n\nuse std::{env, path::PathBuf};\n\nuse anyhow::{anyhow, Error};\nuse tracing::{debug, info};\n\n/// Resolves the default Linera config directory (`~/.config/linera`),\n/// creating it if necessary.\npub fn config_dir() -> Result<PathBuf, Error> {\n    let mut config_dir = dirs::config_dir().ok_or_else(|| {\n        anyhow!(\n            \"Default wallet directory is not supported in this platform: \\\n             please specify storage and wallet paths\"\n        )\n    })?;\n    config_dir.push(\"linera\");\n    if !config_dir.exists() {\n        debug!(\"Creating default wallet directory {}\", config_dir.display());\n        fs_err::create_dir_all(&config_dir)?;\n    }\n    info!(\"Using default wallet directory {}\", config_dir.display());\n    Ok(config_dir)\n}\n\n/// Resolves the wallet file path from an explicit path, environment variable,\n/// or default location.\npub fn wallet_path(explicit: Option<&PathBuf>, suffix: &str) -> Result<PathBuf, Error> {\n    if let Some(path) = explicit {\n        return Ok(path.clone());","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-wallet-json/src/paths.rs#L1-L33","documentation":"Wallet path resolution in linera-wallet-json calls the dirs crate's config_dir(); it returns None on platforms where no conventional user config directory exists. Since wallet_path/keystore_path only fall back to this default when no explicit path or LINERA_WALLET/LINERA_KEYSTORE env var is given, the error tells you to supply paths explicitly.","triggerScenarios":"Running a linera-based binary (wallet_path or keystore_path with explicit=None and no env var) as a service/daemon user with HOME unset, in a stripped-down container without XDG_CONFIG_HOME/HOME, or on an exotic platform the dirs crate does not support.","commonSituations":"Docker containers running as UID without passwd entry (HOME=/ or unset); systemd units without Environment=\"HOME=...\"; minimal BusyBox/embedded targets; CI runners that scrub the environment.","solutions":["Pass explicit --wallet and --keystore paths on the command line","Set LINERA_WALLET=/path/wallet.json and LINERA_KEYSTORE=/path/keystore.json (suffix variants like LINERA_WALLET_0 also work)","Restore a home directory: set HOME=/var/lib/myapp or XDG_CONFIG_HOME=/etc/xdg in the service environment","In Docker, run with a proper USER declaration or pass -e HOME=/tmp"],"exampleFix":"# before\n$ linera-spawn ...   # no HOME, no explicit paths -> error\n\n# after\n$ LINERA_WALLET=/data/wallet.json LINERA_KEYSTORE=/data/keystore.json linera-spawn ...\n# or: export HOME=/data so ~/.config/linera is resolvable","handlingStrategy":"validation","validationCode":"// Resolve paths before any wallet operation\nuse linera_wallet_json::paths::{wallet_path, keystore_path};\nlet w = wallet_path(Some(&PathBuf::from(\"/data/wallet.json\")), \"\")?;\nlet k = keystore_path(Some(&PathBuf::from(\"/data/keystore.json\")), \"\")?;\nassert!(dirs::config_dir().is_some() || /* explicit paths supplied */ true);","typeGuard":null,"tryCatchPattern":"let dir = match linera_wallet_json::paths::config_dir() {\n    Ok(dir) => dir,\n    Err(e) if e.to_string().contains(\"not supported in this platform\") => {\n        anyhow::bail!(\"no user config dir (HOME unset?); pass --wallet/--keystore or set LINERA_WALLET\")\n    }\n    Err(e) => return Err(e),\n};","preventionTips":["Always pass explicit wallet/keystore paths in services and containers","Set HOME or XDG_CONFIG_HOME for daemon users in systemd/Docker units","Add a smoke test that runs the binary with a scrubbed env in CI"],"tags":["linera","wallet","filesystem","platform","configuration","rust"],"backgroundTag":"missing-home-directory","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}