{"record":{"id":"74027ee49635b980","repo":"hyperledger/fabric","slug":"chaincode-s-not-found","errorCode":null,"errorMessage":"chaincode %s not found","messagePattern":"chaincode (.+?) not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/scc/lscc/lscc.go","lineNumber":262,"sourceCode":"\t// chaincode under these conditions. More info on\n\t// https://jira.hyperledger.org/browse/FAB-3156\n\tif fsData.InstantiationPolicy != nil {\n\t\tif !bytes.Equal(fsData.InstantiationPolicy, cd.InstantiationPolicy) {\n\t\t\treturn fmt.Errorf(\"Instantiation policy mismatch for cc %s\", cd.ChaincodeID())\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (lscc *SCC) ChaincodeEndorsementInfo(channelID, chaincodeName string, qe ledger.SimpleQueryExecutor) (*lifecycle.ChaincodeEndorsementInfo, error) {\n\tchaincodeDataBytes, err := qe.GetState(\"lscc\", chaincodeName)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"could not retrieve state for chaincode %s\", chaincodeName)\n\t}\n\n\tif chaincodeDataBytes == nil {\n\t\treturn nil, errors.Errorf(\"chaincode %s not found\", chaincodeName)\n\t}\n\n\tchaincodeData := &ccprovider.ChaincodeData{}\n\terr = proto.Unmarshal(chaincodeDataBytes, chaincodeData)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"chaincode %s has bad definition\", chaincodeName)\n\t}\n\n\tls := &LegacySecurity{\n\t\tSupport:      lscc.Support,\n\t\tPackageCache: &lscc.PackageCache,\n\t}\n\n\terr = ls.SecurityCheckLegacyChaincode(chaincodeData)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"failed security checks\")\n\t}\n","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/scc/lscc/lscc.go#L244-L280","documentation":"ChaincodeEndorsementInfo returns this error when the state query succeeds but returns nil bytes, meaning no chaincode definition with that name exists in the lscc namespace on the channel. Unlike 1216, the ledger is fine — the chaincode simply is not defined/deployed there.","triggerScenarios":"Calling ChaincodeEndorsementInfo(channelID, chaincodeName, qe) with a chaincodeName that was never installed/defined on the channel, or after it was removed; also querying the wrong channel where the chaincode isn't defined.","commonSituations":"Typo in the chaincode name in CLI/SDK calls; querying before the chaincode definition was committed; querying a peer not joined to the channel where the chaincode is defined; referencing a removed/renamed chaincode.","solutions":["Verify the chaincode name spelling and that the definition was committed on that channel (peer chaincode list --installed / queryinstalled)","Commit the chaincode definition first (lifecycle approve/commit) before querying endorsement info","Confirm you are querying the correct channel and a peer joined to it","If the chaincode was migrated/renamed, use the new name"],"exampleFix":"// before\ninfo, err := lscc.ChaincodeEndorsementInfo(\"mychannel\", \"mycc2\", qe) // typo'd name\n// after\nname := \"mycc\"\ninfo, err := lscc.ChaincodeEndorsementInfo(\"mychannel\", name, qe)\nif err != nil && strings.Contains(err.Error(), \"not found\") { /* handle undefined chaincode */ }","handlingStrategy":"validation","validationCode":"// Go: check definition exists before requesting endorsement info\nraw, err := qe.GetState(\"lscc\", chaincodeName)\nif err != nil { return err }\nif raw == nil {\n    return fmt.Errorf(\"chaincode %q is not defined on this channel; approve/commit first\", chaincodeName)\n}","typeGuard":null,"tryCatchPattern":"// Go\ninfo, err := lscc.ChaincodeEndorsementInfo(channelID, name, qe)\nif err != nil {\n    if strings.Contains(err.Error(), fmt.Sprintf(\"chaincode %s not found\", name)) {\n        return fmt.Errorf(\"no definition for %q: commit it via lifecycle or correct the name\", name)\n    }\n    return err\n}","preventionTips":["Commit the chaincode definition (approveformyorg + commit) before querying endorsement info","Double-check chaincode name spelling and target channel in CLI/SDK calls","Verify with `peer chaincode list --channelID` that the definition exists","Confirm the queried peer is joined to the channel where the chaincode is defined"],"tags":["hyperledger-fabric","lscc","chaincode-not-found","not-found"],"backgroundTag":"chaincode-not-found","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}