{"record":{"id":"ae89c41c48bf5acd","repo":"nautechsystems/nautilus_trader","slug":"no-lighter-l2-credentials-in-env","errorCode":null,"errorMessage":"no Lighter L2 credentials in env","messagePattern":"no Lighter L2 credentials in env","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/python/mod.rs","lineNumber":115,"sourceCode":"    }\n}\n\n#[expect(clippy::needless_pass_by_value)]\nfn extract_lighter_exec_config(\n    py: Python<'_>,\n    config: Py<PyAny>,\n) -> PyResult<Box<dyn ClientConfig>> {\n    match config.extract::<LighterExecutionClientConfig>(py) {\n        Ok(c) => Ok(Box::new(c)),\n        Err(e) => Err(to_pyvalue_err(format!(\n            \"Failed to extract LighterExecutionClientConfig: {e}\"\n        ))),\n    }\n}\n\nasync fn submit_integrator_revocation(environment: LighterEnvironment) -> anyhow::Result<String> {\n    let credential = Credential::resolve(None, None, None, environment)?\n        .ok_or_else(|| anyhow::anyhow!(\"no Lighter L2 credentials in env\"))?;\n    let chain_id = lighter_chain_id(environment);\n\n    let raw = LighterRawHttpClient::new(environment, None, 30, None)?;\n    let http = LighterHttpClient::from_raw(raw);\n    let next_nonce = http\n        .get_next_nonce(credential.account_index(), credential.api_key_index())\n        .await?\n        .nonce;\n\n    let now_ms = SystemTime::now().duration_since(UNIX_EPOCH)?.as_millis() as i64;\n\n    let tx = ApproveIntegratorTxInfo {\n        context: TxContext {\n            account_index: credential.account_index(),\n            api_key_index: credential.api_key_index(),\n            nonce: next_nonce,\n            expired_at: now_ms.saturating_add(TX_EXPIRY_MS),\n        },","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/python/mod.rs#L97-L133","documentation":"submit_integrator_revocation needs Lighter L2 (signer) credentials to authenticate the revocation request. Credential::resolve returned None, meaning no API key/private key/account material for the selected environment was found in the environment variables or explicit arguments, so the call aborts with this error.","triggerScenarios":"Calling py_revoke_lighter_integrator (or the underlying submit_integrator_revocation) with explicit credential args None while no Lighter L2 env vars for the chosen environment (e.g. mainnet vs testnet) are set.","commonSituations":"Running the revocation script in a shell/CI where LIGHTER_* env vars are not exported; passing the wrong environment so credentials stored for testnet are not found; key stored in a secrets manager but not exported to env.","solutions":["Export the Lighter L2 credential environment variables expected by Credential::resolve for the target environment (account index, API key index, private key).","Check you selected the correct LighterEnvironment (mainnet vs testnet) matching where your credentials are registered.","Pass the credential values explicitly instead of relying on env resolution.","Verify with `env | grep -i lighter` that the variables are visible to the process."],"exampleFix":"// before\nsubmit_integrator_revocation(LighterEnvironment::Mainnet).await?; // no creds in env\n// after\nexport LIGHTER_MAINNET_PRIVATE_KEY=...;\nexport LIGHTER_MAINNET_ACCOUNT_INDEX=...;\nexport LIGHTER_MAINNET_API_KEY_INDEX=...;\n// then run again","handlingStrategy":"validation","validationCode":"// Check credentials exist before invoking revocation\nstd::env::var(\"LIGHTER_L2_PRIVATE_KEY\")\n    .or_else(|_| std::env::var(\"LIGHTER_PRIVATE_KEY\"))\n    .expect(\"set LIGHTER L2 credentials in env before revocation\");","typeGuard":null,"tryCatchPattern":"match revoke_lighter_integrator(env).await {\n    Ok(tx) => println!(\"revoked: {tx}\"),\n    Err(e) if e.to_string().contains(\"no Lighter L2 credentials\") => {\n        eprintln!(\"export LIGHTER_* credentials for {env:?} first\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Export LIGHTER credential env vars in shell profiles or CI secrets.","Confirm the environment (mainnet/testnet) matches where credentials exist.","Pass credentials explicitly when env resolution is not desired."],"tags":["rust","credentials","environment","auth"],"backgroundTag":"missing-credentials","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}