{"record":{"id":"75032127fa0ebe1d","repo":"hyperledger/fabric","slug":"could-not-retrieve-state-for-chaincode-s-on-chann","errorCode":null,"errorMessage":"could not retrieve state for chaincode %s on channel %s, error %s","messagePattern":"could not retrieve state for chaincode (.+?) on channel (.+?), error (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/handlers/validation/builtin/v13/lscc_validation_logic.go","lineNumber":618,"sourceCode":"\n\t\t// all is good!\n\t\treturn nil\n\tdefault:\n\t\treturn policyErr(fmt.Errorf(\"VSCC error: committing an invocation of function %s of lscc is invalid\", lsccFunc))\n\t}\n}\n\nfunc (vscc *Validator) getInstantiatedCC(chid, ccid string) (cd *ccprovider.ChaincodeData, exists bool, err error) {\n\tqe, err := vscc.stateFetcher.FetchState()\n\tif err != nil {\n\t\terr = fmt.Errorf(\"could not retrieve QueryExecutor for channel %s, error %s\", chid, err)\n\t\treturn\n\t}\n\tdefer qe.Done()\n\tchannelState := &state{qe}\n\tbytes, err := channelState.GetState(\"lscc\", ccid)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"could not retrieve state for chaincode %s on channel %s, error %s\", ccid, chid, err)\n\t\treturn\n\t}\n\n\tif bytes == nil {\n\t\treturn\n\t}\n\n\tcd = &ccprovider.ChaincodeData{}\n\terr = proto.Unmarshal(bytes, cd)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"unmarshalling ChaincodeQueryResponse failed, error %s\", err)\n\t\treturn\n\t}\n\n\texists = true\n\treturn\n}\n","sourceCodeStart":600,"sourceCodeEnd":636,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/handlers/validation/builtin/v13/lscc_validation_logic.go#L600-L636","documentation":"Returned by getInstantiatedCC when channelState.GetState('lscc', ccid) errors (not merely returns nil) — the state query itself failed for that chaincode on the channel, wrapping the underlying state error with the channel context.","triggerScenarios":"Thrown at core/handlers/validation/builtin/v13/lscc_validation_logic.go:618 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped error for state DB failures","Retry after restoring state DB availability"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}