{"record":{"id":"721c4d8c3283a0ee","repo":"hyperledger/fabric","slug":"attempting-to-deploy-a-system-chaincode-s-s","errorCode":null,"errorMessage":"attempting to deploy a system chaincode %s/%s","messagePattern":"attempting to deploy a system chaincode (.+?)/(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/endorser/endorser.go","lineNumber":155,"sourceCode":"\n\t// ----- BEGIN -  SECTION THAT MAY NEED TO BE DONE IN LSCC ------\n\t// if this a call to deploy a chaincode, We need a mechanism\n\t// to pass TxSimulator into LSCC. Till that is worked out this\n\t// special code does the actual deploy, upgrade here so as to collect\n\t// all state under one TxSimulator\n\t//\n\t// NOTE that if there's an error all simulation, including the chaincode\n\t// table changes in lscc will be thrown away\n\tcds, err := protoutil.UnmarshalChaincodeDeploymentSpec(input.Args[2])\n\tif err != nil {\n\t\te.Metrics.SimulationFailure.With(meterLabels...).Add(1)\n\t\treturn nil, nil, err\n\t}\n\n\t// this should not be a system chaincode\n\tif e.Support.IsSysCC(cds.ChaincodeSpec.ChaincodeId.Name) {\n\t\te.Metrics.SimulationFailure.With(meterLabels...).Add(1)\n\t\treturn nil, nil, errors.Errorf(\"attempting to deploy a system chaincode %s/%s\", cds.ChaincodeSpec.ChaincodeId.Name, txParams.ChannelID)\n\t}\n\n\tif len(cds.CodePackage) != 0 {\n\t\te.Metrics.SimulationFailure.With(meterLabels...).Add(1)\n\t\treturn nil, nil, errors.Errorf(\"lscc upgrade/deploy should not include a code packages\")\n\t}\n\n\t_, _, err = e.Support.ExecuteLegacyInit(txParams, cds.ChaincodeSpec.ChaincodeId.Name, cds.ChaincodeSpec.ChaincodeId.Version, cds.ChaincodeSpec.Input)\n\tif err != nil {\n\t\t// increment the failure to indicate instantion/upgrade failures\n\t\tmeterLabels = []string{\n\t\t\t\"channel\", txParams.ChannelID,\n\t\t\t\"chaincode\", cds.ChaincodeSpec.ChaincodeId.Name,\n\t\t}\n\t\te.Metrics.InitFailed.With(meterLabels...).Add(1)\n\t\treturn nil, nil, err\n\t}\n","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/endorser/endorser.go#L137-L173","documentation":"The endorser's callChaincode path handles lscc (lifecycle system chaincode) deploy/upgrade invocations, and user proposals must never target a system chaincode directly. If the ChaincodeSpec's chaincode name is a registered system CC, the proposal is rejected as a simulation failure.","triggerScenarios":"Submitting a transaction proposal whose ChaincodeSpec.ChaincodeId.Name is a system chaincode (e.g. 'lscc', 'qscc', 'cscc', 'escc', 'vscc') through the endorser's deploy/upgrade path.","commonSituations":"Clients built against old Fabric APIs that invoked lscc directly to deploy chaincodes; tooling/scripts from Fabric 1.x used on newer lifecycle; typos targeting system CCs.","solutions":["Use the new lifecycle (_lifecycle) CLI/SDK flow instead of invoking lscc directly","Rename the target chaincode in the proposal to a user (application) chaincode","If querying a system CC is intended, use the appropriate query path/channel rather than a deploy proposal"],"exampleFix":"// before\nccName := \"lscc\" // deploy via system CC\n// after\nccName := \"mycc\" // deploy via _lifecycle approve/commit flow","handlingStrategy":"validation","validationCode":"sysCCs := map[string]bool{\"lscc\":true,\"qscc\":true,\"cscc\":true,\"escc\":true,\"vscc\":true,\"_lifecycle\":true}\nif sysCCs[spec.ChaincodeId.Name] {\n    return errors.New(\"cannot deploy a system chaincode\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never target system chaincodes in deploy/upgrade proposals","Migrate legacy lscc invocations to the _lifecycle flow","Keep a list of reserved system CC names in client tooling"],"tags":["endorser","system-chaincode","lifecycle","deployment"],"backgroundTag":"system-chaincode-deploy-forbidden","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"}