warpdotdev/warp · error
could not determine home directory
Error message
could not determine home directory
What it means
Thrown by claude_config_dir() (claude_transcript.rs) when CLAUDE_CONFIG_DIR is unset and home_dir_for_claude_config() yields None. The transcript machinery uses this directory (~/.claude) to locate Claude Code session rollout files, so transcript hydration for a session cannot proceed.
Source
Thrown at app/src/ai/agent_sdk/driver/harness/claude_transcript.rs:95
/// Claude CLI convention of replacing every `/` with `-`.
///
/// Example: `/Users/ben/src/foo` → `-Users-ben-src-foo`
pub(crate) fn encode_cwd(cwd: &Path) -> String {
cwd.to_string_lossy().replace(['/', '.'], "-")
}
/// Resolve the Claude config directory.
///
/// Reads `$CLAUDE_CONFIG_DIR` if set, otherwise falls back to `~/.claude`.
//
/// TODO(REMOTE-1209): Use the transcript path reported by our hook.
pub(crate) fn claude_config_dir() -> Result<PathBuf> {
if let Ok(dir) = std::env::var("CLAUDE_CONFIG_DIR") {
return Ok(PathBuf::from(dir));
}
home_dir_for_claude_config()
.map(|h| h.join(".claude"))
.ok_or_else(|| anyhow::anyhow!("could not determine home directory"))
}
/// In tests on Windows, `dirs::home_dir()` ignores `HOME`, so we check it
/// manually so that tests can override the home directory.
pub(super) fn home_dir_for_claude_config() -> Option<PathBuf> {
#[cfg(test)]
if let Some(home) = std::env::var_os("HOME")
&& !home.is_empty()
{
return Some(PathBuf::from(home));
}
dirs::home_dir()
}
/// Assemble a [`ClaudeTranscriptEnvelope`] from the Claude config directory.
///
/// Reads:
/// - `<config_root>/projects/<encoded_cwd>/<session_uuid>.jsonl` - main transcriptView on GitHub (pinned to e72fd7aacb)
Solutions
- Set CLAUDE_CONFIG_DIR to the directory holding the .claude session data (or at least a writable dir) in the agent environment.
- Otherwise ensure HOME/USERPROFILE is set to a valid, readable path.
- If transcripts live elsewhere on your setup, point CLAUDE_CONFIG_DIR there so session discovery works.
Example fix
# before unset HOME; warp agent … # transcript resolution fails # after export CLAUDE_CONFIG_DIR=/var/lib/warp/claude # or set HOME=/root warp agent …
Defensive patterns
Strategy: validation
Validate before calling
let dir = std::env::var("CLAUDE_CONFIG_DIR").ok().filter(|d| !d.is_empty());
anyhow::ensure!(dir.is_some() || dirs::home_dir().is_some(), "set CLAUDE_CONFIG_DIR or HOME for transcript resolution"); Type guard
fn claude_transcripts_locatable() -> bool {
std::env::var("CLAUDE_CONFIG_DIR").map(|d| !d.is_empty()).unwrap_or(false) || dirs::home_dir().is_some()
} Try / catch
match claude_config_dir() {
Err(err) if err.to_string().contains("could not determine home directory") => {
// no transcript dir → skip hydration instead of failing the whole session
Ok(None)
}
rest => rest.map(Some),
} Prevention
- Set CLAUDE_CONFIG_DIR when session data lives outside the default ~/.claude.
- Keep HOME defined in the process resolving transcripts.
- Note CLAUDE_CONFIG_DIR="" is treated as unset here — export a real path.
When it happens
Trigger: Resolving Claude transcripts for a conversation (finding session jsonl files, continuation commands) with CLAUDE_CONFIG_DIR unset/empty and no home directory — unset HOME on Unix, unset USERPROFILE on Windows, or getpwuid failing for the runtime user.
Common situations: Same class as the other home-dir errors: containers, CI, systemd services, or sandboxes where HOME was stripped; also note the code reads CLAUDE_CONFIG_DIR without an emptiness check here, so CLAUDE_CONFIG_DIR="" still falls through to the failing home lookup.
Related errors
- could not determine home directory
- could not determine home directory
- could not determine home directory
- Could not determine home directory
- could not determine home directory
AI-assisted analysis of warpdotdev/warp@e72fd7aacb (2026-08-16).
Data as JSON: /api/errors/76f6fd8326d13b4f.
Report an issue: GitHub.