linera-io/linera-protocol · error
Default wallet directory is not supported in this platform:
Error message
Default wallet directory is not supported in this platform: please specify storage and wallet paths
What it means
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.
Source
Thrown at linera-wallet-json/src/paths.rs:15
// Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! Default file path resolution for wallet, keystore, and config directory.
use std::{env, path::PathBuf};
use anyhow::{anyhow, Error};
use tracing::{debug, info};
/// Resolves the default Linera config directory (`~/.config/linera`),
/// creating it if necessary.
pub fn config_dir() -> Result<PathBuf, Error> {
let mut config_dir = dirs::config_dir().ok_or_else(|| {
anyhow!(
"Default wallet directory is not supported in this platform: \
please specify storage and wallet paths"
)
})?;
config_dir.push("linera");
if !config_dir.exists() {
debug!("Creating default wallet directory {}", config_dir.display());
fs_err::create_dir_all(&config_dir)?;
}
info!("Using default wallet directory {}", config_dir.display());
Ok(config_dir)
}
/// Resolves the wallet file path from an explicit path, environment variable,
/// or default location.
pub fn wallet_path(explicit: Option<&PathBuf>, suffix: &str) -> Result<PathBuf, Error> {
if let Some(path) = explicit {
return Ok(path.clone());View on GitHub (pinned to 6c226ddcb3)
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
Example fix
# before $ linera-spawn ... # no HOME, no explicit paths -> error # after $ LINERA_WALLET=/data/wallet.json LINERA_KEYSTORE=/data/keystore.json linera-spawn ... # or: export HOME=/data so ~/.config/linera is resolvable
Defensive patterns
Strategy: validation
Validate before calling
// Resolve paths before any wallet operation
use linera_wallet_json::paths::{wallet_path, keystore_path};
let w = wallet_path(Some(&PathBuf::from("/data/wallet.json")), "")?;
let k = keystore_path(Some(&PathBuf::from("/data/keystore.json")), "")?;
assert!(dirs::config_dir().is_some() || /* explicit paths supplied */ true); Try / catch
let dir = match linera_wallet_json::paths::config_dir() {
Ok(dir) => dir,
Err(e) if e.to_string().contains("not supported in this platform") => {
anyhow::bail!("no user config dir (HOME unset?); pass --wallet/--keystore or set LINERA_WALLET")
}
Err(e) => return Err(e),
}; Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Wallet already exists: {}
- nonexistent chain `{chain_id}`
- keypair not found for chain `{chain_id}`
- invalid block export configuration: {message}
- unexpected query response: {other:?}
AI-assisted analysis of linera-io/linera-protocol@6c226ddcb3 (2026-08-22).
Data as JSON: /api/errors/1168935476c87785.
Report an issue: GitHub.