tinyhumansai/openhuman · error
Failed to determine user home directory
Error message
Failed to determine user home directory
What it means
`resolve_openclaw_workspace` builds the default source path `~/.openclaw/workspace` from `directories::UserDirs::new()`. When the platform cannot determine a home directory that call returns None and the resolver bails before any migration work starts. An explicit `source` argument short-circuits resolution and never hits this error.
Source
Thrown at src/openhuman/config/migration_helpers/core.rs:271
entries.push(SourceEntry {
key: normalize_key(file_stem, idx),
content: content.trim().to_string(),
category: MemoryCategory::Core,
});
idx += 1;
}
Ok(entries)
}
fn resolve_openclaw_workspace(source: Option<PathBuf>) -> Result<PathBuf> {
if let Some(path) = source {
return Ok(path);
}
let Some(user_dirs) = UserDirs::new() else {
bail!("Failed to determine user home directory");
};
Ok(user_dirs.home_dir().join(".openclaw").join("workspace"))
}
fn resolve_hermes_workspace(source: Option<PathBuf>) -> Result<PathBuf> {
if let Some(path) = source {
return Ok(path);
}
let Some(user_dirs) = UserDirs::new() else {
bail!("Failed to determine user home directory");
};
#[cfg(windows)]
{
if let Some(local_app_data) = std::env::var_os("LOCALAPPDATA") {
return Ok(PathBuf::from(local_app_data).join("hermes"));View on GitHub (pinned to 7491200858)
Solutions
- Pass the OpenClaw source workspace path explicitly to the migration call.
- Set HOME (or the platform's home env var) for the process and retry.
- Run the migration from a normal interactive user session.
Example fix
# before — daemon with scrubbed env, default resolution fails ExecStart=openhuman-core migrate openclaw # after — explicit source (or set HOME in the unit) ExecStart=openhuman-core migrate openclaw --source /srv/openclaw/workspace Environment=HOME=/var/lib/openhuman
Defensive patterns
Strategy: validation
Validate before calling
let source = match explicit_source {
Some(p) => p,
None => match directories::UserDirs::new() {
Some(u) => u.home_dir().join(".openclaw").join("workspace"),
None => return Ok(None), // no home resolvable — require an explicit path
},
};
let report = migrate_openclaw_memory(&config, Some(source), dry_run).await?; Prevention
- Always pass an explicit source path in headless/service contexts
- Ensure HOME is set for daemons, containers, and CI runners
- Run migrations from interactive user sessions where the home dir is guaranteed
When it happens
Trigger: Calling the OpenClaw migration without an explicit source path from a process whose home directory is not resolvable — HOME unset (scrubbed daemon/container environment), a service account without a profile, or unusual platform configurations.
Common situations: systemd units, docker containers, and CI runners with a minimal environment; running the core under a user with no passwd entry; hardened sandboxes that strip env vars.
Related errors
- OpenClaw workspace not found at {}. Provide a valid source w
- Source workspace matches current OpenHuman workspace; refusi
- OpenClaw memories table found but no content-like column was
- Core returned an empty backend URL
- OpenRouter OAuth requires the desktop app. Use an API key in
AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17).
Data as JSON: /api/errors/0a7306ffca43aeec.
Report an issue: GitHub.