Bug Description
getAccount in src/lib/actions/BaseAction.ts (lines 130-136)
unconditionally reads the keystore file after calling
createKeypairByName, even if it failed and never created the file.
Root Cause
if(!existsSync(keystorePath)){awaitthis.confirmPrompt(`Account '${accountName}' not found. Would you like to create it?`);decryptedPrivateKey=awaitthis.createKeypairByName(accountName,false);}keystoreJson=readFileSync(keystorePath,"utf-8");// line 135: no error checkkeystoreData=JSON.parse(keystoreJson);// line 136Impact
If createKeypairByName fails for any reason other than
password mismatch (e.g., disk full, permissions error during
writeFileSync), the keystore file is never created. The code
then crashes with an unhandled ENOENT error on line 135
instead of a clear error message.
Suggested Fix
decryptedPrivateKey=awaitthis.createKeypairByName(accountName,false);if(!existsSync(keystorePath)){this.failSpinner(`Failed to create keystore file for account '${accountName}'`);return;}File
src/lib/actions/BaseAction.ts lines 130-136
Severity: High
Bug Description
getAccountinsrc/lib/actions/BaseAction.ts(lines 130-136)unconditionally reads the keystore file after calling
createKeypairByName, even if it failed and never created the file.Root Cause
Impact
If
createKeypairByNamefails for any reason other thanpassword mismatch (e.g., disk full, permissions error during
writeFileSync), the keystore file is never created. The codethen crashes with an unhandled
ENOENTerror on line 135instead of a clear error message.
Suggested Fix
File
src/lib/actions/BaseAction.tslines 130-136Severity: High