{"record":{"id":"d4ee9ea9d1f004f1","repo":"nautechsystems/nautilus_trader","slug":"signer-private-key-environment-variable-is-no","errorCode":null,"errorMessage":"Signer private key environment variable '{}' is not set","messagePattern":"Signer private key environment variable '(.+?)' is not set","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":6169,"sourceCode":"        }\n\n        let payload_connect_lease = if let (Some(database), Some(keys)) =\n            (self.cache.database.as_ref(), self.payload_keys.as_deref())\n        {\n            Some(\n                database\n                    .require_execution_payload_storage(keys, self.payload_policy(), 100)\n                    .await?,\n            )\n        } else {\n            None\n        };\n\n        // Load the signer key from the configured environment variable; the key is never\n        // logged, serialized, or stored in configuration\n        let private_key = Zeroizing::new(\n            std::env::var(&self.config.signer_private_key_env).map_err(|_| {\n                anyhow::anyhow!(\n                    \"Signer private key environment variable '{}' is not set\",\n                    self.config.signer_private_key_env\n                )\n            })?,\n        );\n        let encoded_key = private_key.trim();\n        let encoded_key = encoded_key.strip_prefix(\"0x\").unwrap_or(encoded_key);\n        let key_bytes = Zeroizing::new(hex::decode_array::<32>(encoded_key).map_err(|_| {\n            anyhow::anyhow!(\n                \"Signer private key in '{}' is not a valid hex private key\",\n                self.config.signer_private_key_env\n            )\n        })?);\n        let signer = PrivateKeySigner::from_slice(&key_bytes[..]).map_err(|_| {\n            anyhow::anyhow!(\n                \"Signer private key in '{}' is not a valid secp256k1 private key\",\n                self.config.signer_private_key_env\n            )","sourceCodeStart":6151,"sourceCodeEnd":6187,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L6151-L6187","documentation":"The execution client loads its transaction-signing key exclusively from the environment variable named by config.signer_private_key_env. If that variable is unset, initialization aborts with this error; the key is deliberately never stored in config files or logs.","triggerScenarios":"Client init/connect runs std::env::var(self.config.signer_private_key_env) and gets Err (VarError::NotPresent) — the variable name is set in config but not exported in the process environment.","commonSituations":"Variable defined in .env file that is never loaded (no dotenv/systemd EnvironmentFile), typo between the configured name and the exported name, running under a service manager that strips the environment, or deploying with a secrets manager that did not inject it.","solutions":["Export the variable in the process environment: export <VAR>=<hex key> before launching the process.","Check the configured signer_private_key_env string matches the actual environment variable name exactly (case-sensitive).","If using .env/docker/systemd, ensure the env file is actually loaded (docker --env-file, systemd EnvironmentFile, dotenv::dotenv().ok()).","Verify secrets injection in CI/production (secrets mounted to env, correct secret key name)."],"exampleFix":"// before\n# config: signer_private_key_env = \"SIGNER_KEY\"  (never exported)\n./nautilus-blockchain\n\n// after\nexport SIGNER_KEY=0x<64-hex-private-key>\n./nautilus-blockchain","handlingStrategy":"validation","validationCode":"let var_name = std::env::var(\"SIGNER_KEY_ENV_NAME\").expect(\"config\");\nif std::env::var(&var_name).is_err() {\n    panic!(\"required signer env var '{}' is not exported\", var_name);\n}","typeGuard":null,"tryCatchPattern":"match client.connect().await {\n    Err(e) if e.to_string().contains(\"is not set\") => eprintln!(\"export the signer key env var and retry\"),\n    other => other.map(|_| ()),\n}","preventionTips":["Export signer env vars in the process manager (systemd EnvironmentFile, docker --env-file)","Keep configured env var names and exported names in one source of truth","Run a preflight env check before starting the client","Load .env files explicitly if you rely on them"],"tags":["environment","secrets","configuration","signing"],"backgroundTag":"missing-env-var","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}