{"record":{"id":"d102c94aab80d261","repo":"tinyhumansai/openhuman","slug":"failed-to-load-dotenv-from-openhuman-dotenv-path","errorCode":null,"errorMessage":"failed to load dotenv from OPENHUMAN_DOTENV_PATH={path}: {e}","messagePattern":"failed to load dotenv from OPENHUMAN_DOTENV_PATH=(.+?): (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/core/cli.rs","lineNumber":341,"sourceCode":"        \"sentry-test unavailable: built without the crash-reporting feature — \\\n         rebuild with `--features crash-reporting`\"\n    ))\n}\n\n/// Loads key/value pairs from a `.env` file into the process environment.\n///\n/// This is used for all CLI entrypoints so direct namespace commands pick up\n/// the same repo-local configuration as `run` / `serve`.\n///\n/// Precedence:\n/// 1. Variables already set in the process environment are **not** overwritten.\n/// 2. If `OPENHUMAN_DOTENV_PATH` is set, that file is loaded.\n/// 3. Otherwise, it searches for `.env` in the current working directory.\npub(crate) fn load_dotenv_for_cli() -> Result<()> {\n    match std::env::var(\"OPENHUMAN_DOTENV_PATH\") {\n        Ok(path) if !path.trim().is_empty() => {\n            dotenvy::from_path(&path).map_err(|e| {\n                anyhow::anyhow!(\"failed to load dotenv from OPENHUMAN_DOTENV_PATH={path}: {e}\")\n            })?;\n        }\n        _ => {\n            let _ = dotenvy::dotenv();\n        }\n    }\n    Ok(())\n}\n\n/// Handles the `run` subcommand to start the core HTTP/JSON-RPC server.\n///\n/// This command boots the main application server, including its JSON-RPC\n/// endpoint, Socket.IO bridge, and background services (voice, vision, etc.).\n///\n/// # Arguments\n///\n/// * `args` - Command-line arguments for the `run` command (e.g., `--port`).\nfn run_server_command(args: &[String]) -> Result<()> {","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/core/cli.rs#L323-L359","documentation":"Loader diagnostic in the CLI dotenv bootstrap: an explicit `OPENHUMAN_DOTENV_PATH` was set but dotenv failed to parse/read that file. The named path is user-specified (search-path guessing is a separate branch), so the file at that path is missing, unreadable, or malformed.","triggerScenarios":"Thrown at src/core/cli.rs:341 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the path in OPENHUMAN_DOTENV_PATH exists and is readable","Fix KEY=VALUE syntax errors in the .env file","Unset OPENHUMAN_DOTENV_PATH to fall back to .env discovery from the current directory"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}