{"record":{"id":"242ebb94a67f3b41","repo":"canopy-network/canopy","slug":"invalid-password","errorCode":null,"errorMessage":"invalid password","messagePattern":"invalid password","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/crypto/keystore.go","lineNumber":114,"sourceCode":"\t\tif ok && opts.Nickname != oldNickname {\n\t\t\treturn errors.New(\"nickname already used\")\n\t\t}\n\t\tks.NicknameMap[opts.Nickname] = encrypted.KeyAddress\n\t}\n\n\tks.AddressMap[encrypted.KeyAddress] = encrypted\n\n\treturn nil\n}\n\ntype ImportRawOpts struct {\n\tNickname string\n}\n\n// ImportRaw() imports a non-encrypted private key to the store, but encrypts it given a password\nfunc (ks *Keystore) ImportRaw(privateKeyBytes []byte, password string, opts ImportRawOpts) (address string, err error) {\n\tif password == \"\" {\n\t\treturn \"\", fmt.Errorf(\"invalid password\")\n\t}\n\n\tprivateKey, err := NewPrivateKeyFromBytes(privateKeyBytes)\n\tif err != nil {\n\t\treturn\n\t}\n\tpublicKey := privateKey.PublicKey()\n\n\tencrypted, err := EncryptPrivateKey(publicKey.Bytes(), privateKeyBytes, []byte(password), address)\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = ks.Import(encrypted, ImportOpts{\n\t\tAddress:  publicKey.Address().Bytes(),\n\t\tNickname: opts.Nickname,\n\t})\n\tif err != nil {","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/canopy-network/canopy/blob/ee8197d91dd410f6592cb650a94c925ee6dc8bad/lib/crypto/keystore.go#L96-L132","documentation":"Raised in Keystore.ImportRaw when the supplied password is the empty string. The keystore refuses to encrypt and store a private key without a non-empty password, since it would be stored effectively unprotected; the key is not imported.","triggerScenarios":"Thrown at lib/crypto/keystore.go:114 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Supply a non-empty password when calling ImportRaw.","Prompt the user interactively if the password was read from an empty env var or config field.","Distinguish this from decrypt failures downstream: this fires before any encryption happens."],"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"}