tinyhumansai/openhuman · error
failed to load dotenv from OPENHUMAN_DOTENV_PATH={path}: {e}
Error message
failed to load dotenv from OPENHUMAN_DOTENV_PATH={path}: {e} What it means
OPENHUMAN_DOTENV_PATH is set to a non-empty value, and dotenvy::from_path failed on it — the file does not exist, is unreadable, or is malformed. This path is strict by design: an explicitly configured dotenv that silently fails would hide config differences. By contrast, when the variable is unset, the cwd `.env` discovery (`dotenvy::dotenv()`) ignores errors entirely.
Source
Thrown at src/core/cli.rs:341
"sentry-test unavailable: built without the crash-reporting feature — \
rebuild with `--features crash-reporting`"
))
}
/// Loads key/value pairs from a `.env` file into the process environment.
///
/// This is used for all CLI entrypoints so direct namespace commands pick up
/// the same repo-local configuration as `run` / `serve`.
///
/// Precedence:
/// 1. Variables already set in the process environment are **not** overwritten.
/// 2. If `OPENHUMAN_DOTENV_PATH` is set, that file is loaded.
/// 3. Otherwise, it searches for `.env` in the current working directory.
pub(crate) fn load_dotenv_for_cli() -> Result<()> {
match std::env::var("OPENHUMAN_DOTENV_PATH") {
Ok(path) if !path.trim().is_empty() => {
dotenvy::from_path(&path).map_err(|e| {
anyhow::anyhow!("failed to load dotenv from OPENHUMAN_DOTENV_PATH={path}: {e}")
})?;
}
_ => {
let _ = dotenvy::dotenv();
}
}
Ok(())
}
/// Handles the `run` subcommand to start the core HTTP/JSON-RPC server.
///
/// This command boots the main application server, including its JSON-RPC
/// endpoint, Socket.IO bridge, and background services (voice, vision, etc.).
///
/// # Arguments
///
/// * `args` - Command-line arguments for the `run` command (e.g., `--port`).
fn run_server_command(args: &[String]) -> Result<()> {View on GitHub (pinned to a221052e0d)
Solutions
- Verify the target: `ls -l "$OPENHUMAN_DOTENV_PATH"` and confirm it exists and is readable
- Point the variable at the correct file, preferably with an absolute path
- If cwd `.env` discovery is what you want, unset the variable: `unset OPENHUMAN_DOTENV_PATH`
Example fix
# before export OPENHUMAN_DOTENV_PATH=.env.local # file does not exist openhuman run # after export OPENHUMAN_DOTENV_PATH=/abs/path/to/repo/.env.local openhuman run # or fall back to cwd discovery unset OPENHUMAN_DOTENV_PATH
Defensive patterns
Strategy: validation
Validate before calling
# bash: check the explicit dotenv target before any openhuman command
if [ -n "${OPENHUMAN_DOTENV_PATH:-}" ] && [ ! -r "$OPENHUMAN_DOTENV_PATH" ]; then
echo "OPENHUMAN_DOTENV_PATH is not a readable file: $OPENHUMAN_DOTENV_PATH" >&2; exit 1
fi Prevention
- Use absolute paths for OPENHUMAN_DOTENV_PATH — relative paths resolve against whatever cwd the CLI starts in
- Unset the variable in environments that should rely on cwd `.env` discovery (which is non-fatal)
- Remember precedence: already-set process env vars win, so a broken file may still 'work' silently if vars are exported elsewhere
When it happens
Trigger: OPENHUMAN_DOTENV_PATH points to a nonexistent or misspelled file; the file lacks read permission; the .env has dotenv syntax errors; the path is relative and the process cwd differs from the assumed one.
Common situations: A stale variable exported in a shell profile or CI job pointing at a moved/removed file; container mounts that place .env elsewhere; deploying with a different user that cannot read the file.
Related errors
- OPENAI_API_KEY is required unless --no-ai or --dry-run is us
- empty value for {arg}
- Sentry is not initialized in this binary — no DSN is resolva
- memory driver `{driver_id}` does not advertise the `{cap}` c
- memory driver `{driver_id}` is not the embedded TinyCortex d
AI-assisted analysis of tinyhumansai/openhuman@a221052e0d (2026-08-16).
Data as JSON: /api/errors/d102c94aab80d261.
Report an issue: GitHub.