{"record":{"id":"ae2c05cbe5c9f2ce","repo":"hyperledger/fabric","slug":"lscc-s-state-for-s-not-found","errorCode":null,"errorMessage":"lscc's state for [%s] not found.","messagePattern":"lscc's state for \\[(.+?)\\] not found\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/committer/txvalidator/v14/vscc_validator.go","lineNumber":308,"sourceCode":"\tif l == nil {\n\t\treturn nil, errors.New(\"nil ledger instance\")\n\t}\n\n\tqe, err := l.NewQueryExecutor()\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"could not retrieve QueryExecutor\")\n\t}\n\tdefer qe.Done()\n\n\tbytes, err := qe.GetState(\"lscc\", ccid)\n\tif err != nil {\n\t\treturn nil, &commonerrors.VSCCInfoLookupFailureError{\n\t\t\tReason: fmt.Sprintf(\"Could not retrieve state for chaincode %s, error %s\", ccid, err),\n\t\t}\n\t}\n\n\tif bytes == nil {\n\t\treturn nil, errors.Errorf(\"lscc's state for [%s] not found.\", ccid)\n\t}\n\n\tcd := &ccprovider.ChaincodeData{}\n\terr = proto.Unmarshal(bytes, cd)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unmarshalling ChaincodeQueryResponse failed\")\n\t}\n\n\tif cd.Vscc == \"\" {\n\t\treturn nil, errors.Errorf(\"lscc's state for [%s] is invalid, vscc field must be set\", ccid)\n\t}\n\n\tif len(cd.Policy) == 0 {\n\t\treturn nil, errors.Errorf(\"lscc's state for [%s] is invalid, policy field must be set\", ccid)\n\t}\n\n\treturn cd, err\n}","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/committer/txvalidator/v14/vscc_validator.go#L290-L326","documentation":"getCDataForCC queries lscc's state for the chaincode's ChaincodeData; when the returned bytes are nil, the chaincode is not known to lscc on this channel. The error means validation cannot find lifecycle records for the chaincode, so the transaction cannot be validated against a version/policy and is treated as an info-lookup failure (VSCCEndorsementPolicyError family).","triggerScenarios":"GetInfoForValidate -> getCDataForCC where the state lookup returns nil bytes for ccid — the chaincode was never instantiated/deployed on the channel, or its lscc record was removed.","commonSituations":"Transaction targets a chaincode not instantiated on that channel; chaincode installed but never instantiated (v1.x); channel mismatch (invoked on wrong channel); state DB corruption dropping lscc keys.","solutions":["Instantiate/deploy the chaincode on the channel (peer chaincode instantiate) before submitting transactions","Verify the client is targeting the correct channel where the chaincode is instantiated","Run peer chaincode list -C <channel> to confirm deployment","Check the state database for lscc corruption and rebuild it if records are missing"],"exampleFix":"// before: invoke on channel where cc is not instantiated\nawait channel.sendTx(contract on 'channelB');\n// after\npeer chaincode instantiate -C channelA -n mycc -v 1.0 -c '{\"Args\":[\"init\"]}'","handlingStrategy":"validation","validationCode":"const list = await channel.queryInstantiatedChaincodes();\nif (!list.some(c => c.name === 'mycc')) throw new Error('mycc not instantiated on channel');","typeGuard":"function isInstantiated(instantiated, name) {\n  return Array.isArray(instantiated) && instantiated.some(c => c.name === name);\n}","tryCatchPattern":"try { await contract.submitTransaction('move'); } catch (e) {\n  if (String(e).includes(\"not found\") || String(e).includes(\"lscc's state\")) { /* instantiate the chaincode, then retry */ }\n}","preventionTips":["Always instantiate before invoking (v1.x lifecycle)","Target the correct channel name in clients","Run peer chaincode list to verify deployments"],"tags":["hyperledger-fabric","lscc","chaincode-not-found","tx-validation"],"backgroundTag":"chaincode-not-instantiated","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"}