{"record":{"id":"44e7ac5d3c2bcddd","repo":"FuelLabs/fuels-rs","slug":"home-env-var-missing","errorCode":null,"errorMessage":"HOME env var missing","messagePattern":"HOME env var missing","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/fuels-test-helpers/src/fuel_bin_service.rs","lineNumber":49,"sourceCode":"            \"--ip\".to_string(),\n            \"127.0.0.1\".to_string(),\n            \"--port\".to_string(),\n            \"0\".to_string(),\n            \"--snapshot\".to_string(),\n            self.snapshot_dir\n                .path()\n                .to_str()\n                .expect(\"Failed to find config file\")\n                .to_string(),\n        ];\n\n        args.push(\"--db-type\".to_string());\n        match &self.node_config.database_type {\n            DbType::InMemory => args.push(\"in-memory\".to_string()),\n            DbType::RocksDb(path_to_db) => {\n                args.push(\"rocks-db\".to_string());\n                let path = path_to_db.as_ref().cloned().unwrap_or_else(|| {\n                    PathBuf::from(std::env::var(\"HOME\").expect(\"HOME env var missing\"))\n                        .join(\".fuel/db\")\n                });\n                args.push(\"--db-path\".to_string());\n                args.push(path.to_string_lossy().to_string());\n            }\n        }\n\n        if let Some(cache_size) = self.node_config.max_database_cache_size {\n            args.push(\"--max-database-cache-size\".to_string());\n            args.push(cache_size.to_string());\n        }\n\n        match self.node_config.block_production {\n            Trigger::Instant => {\n                args.push(\"--poa-instant=true\".to_string());\n            }\n            Trigger::Never => {\n                args.push(\"--poa-instant=false\".to_string());","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/FuelLabs/fuels-rs/blob/d9a250a51818dda64bfeb5ef7cc19cf27bdcd623/packages/fuels-test-helpers/src/fuel_bin_service.rs#L31-L67","documentation":"When FuelBinService (test helpers) is configured with DbType::RocksDb and no explicit database path, it defaults to $HOME/.fuel/db by reading the HOME environment variable. The expect panics when HOME is unset.","triggerScenarios":"Running tests that start a RocksDb-backed local node with node_config.database_type = DbType::RocksDb(None) inside an environment without HOME: minimal Docker containers, scrubbed CI shells, cron or systemd contexts.","commonSituations":"Docker scratch/distroless images; CI runners that clear the environment; headless agents running the test suite.","solutions":["Set HOME in the environment (ENV HOME=/root in Docker, export HOME=... in shell)","Pass an explicit path instead: DbType::RocksDb(Some(PathBuf::from(\"./tmp-db\"))) in the NodeConfig","Run the tests from a normal user shell where HOME is defined"],"exampleFix":"// before\nlet mut node_config = NodeConfig::default();\nnode_config.database_type = DbType::RocksDb(None); // panics when HOME is unset\n\n// after: explicit db path, no HOME dependency\nlet mut node_config = NodeConfig::default();\nnode_config.database_type = DbType::RocksDb(Some(std::path::PathBuf::from(\"/tmp/fuel-test-db\")));","handlingStrategy":"validation","validationCode":"// Guard before configuring a RocksDb-backed test node\nif matches!(node_config.database_type, DbType::RocksDb(None)) {\n    assert!(\n        std::env::var(\"HOME\").is_ok(),\n        \"HOME must be set, or provide an explicit db path via DbType::RocksDb(Some(path))\"\n    );\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set HOME explicitly in Dockerfiles and CI environments that run the test suite","Prefer DbType::RocksDb(Some(explicit_path)) so tests do not depend on the environment","Use in-memory DB for tests that do not need persistence"],"tags":["test-helpers","environment","database","local-node"],"backgroundTag":null,"analyzedSha":"d9a250a51818dda64bfeb5ef7cc19cf27bdcd623","analyzedAt":"2026-08-16T09:49:30.618Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}