{"record":{"id":"c39db1a19cb1f52a","repo":"canopy-network/canopy","slug":"key-not-found","errorCode":null,"errorMessage":"key not found","messagePattern":"key not found","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/crypto/keystore.go","lineNumber":145,"sourceCode":"\n\terr = ks.Import(encrypted, ImportOpts{\n\t\tAddress:  publicKey.Address().Bytes(),\n\t\tNickname: opts.Nickname,\n\t})\n\tif err != nil {\n\t\treturn\n\t}\n\n\taddress = publicKey.Address().String()\n\n\treturn\n}\n\n// GetKey() returns the PrivateKeyI interface for an address and decrypts it using the password\nfunc (ks *Keystore) GetKey(address []byte, password string) (PrivateKeyI, error) {\n\tv, ok := ks.AddressMap[hex.EncodeToString(address)]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"key not found\")\n\t}\n\treturn DecryptPrivateKey(v, []byte(password))\n}\n\ntype GetKeyGroupOpts struct {\n\tAddress  []byte\n\tNickname string\n}\n\n// GetKeyGroup() returns the full keygroup for an address or nickname and decrypts the private key using the password\nfunc (ks *Keystore) GetKeyGroup(password string, opts GetKeyGroupOpts) (*KeyGroup, error) {\n\tvar stringAddress string\n\tif opts.Address != nil {\n\t\tstringAddress = hex.EncodeToString(opts.Address)\n\t}\n\tif opts.Nickname != \"\" {\n\t\tstringAddress = ks.NicknameMap[opts.Nickname]\n\t}","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/canopy-network/canopy/blob/ee8197d91dd410f6592cb650a94c925ee6dc8bad/lib/crypto/keystore.go#L127-L163","documentation":"Raised in Keystore.GetKey when no key is registered in AddressMap for the hex-encoded address argument. The address has never been imported (or was deleted), so there is nothing to decrypt; this is a lookup miss, not a wrong-password error (which DecryptPrivateKey would raise).","triggerScenarios":"Thrown at lib/crypto/keystore.go:145 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the address was imported (ImportRaw/Import) before calling GetKey.","Check that the address bytes are hex-encoded the same way the keystore stores keys (hex.EncodeToString).","If the key may have been deleted, recreate/import it before retrying."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ee8197d91dd410f6592cb650a94c925ee6dc8bad","analyzedAt":"2026-09-06T09:30:15.973Z","contentChangedAt":"2026-09-06T09:30:15.973Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}