{"record":{"id":"0f1ec9dfb8f0c32e","repo":"hyperledger/fabric","slug":"vscc-error-committing-an-invocation-of-function","errorCode":null,"errorMessage":"VSCC error: committing an invocation of function %s of lscc is invalid","messagePattern":"VSCC error: committing an invocation of function (.+?) of lscc is invalid","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/handlers/validation/builtin/v12/validation_logic.go","lineNumber":746,"sourceCode":"\t\t\t\tpolNew := cdRWSet.InstantiationPolicy\n\t\t\t\tif polNew == nil {\n\t\t\t\t\treturn policyErr(fmt.Errorf(\"No instantiation policy was specified\"))\n\t\t\t\t}\n\n\t\t\t\t// no point in checking it again if they are the same policy\n\t\t\t\tif !bytes.Equal(polNew, pol) {\n\t\t\t\t\terr = vscc.checkInstantiationPolicy(chid, env, polNew, payl)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\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 {","sourceCodeStart":728,"sourceCodeEnd":764,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/handlers/validation/builtin/v12/validation_logic.go#L728-L764","documentation":"VSCC only recognizes a fixed set of LSCC functions (deploy/instantiate, upgrade) as valid. If the transaction invokes lscc with any other function name, it is rejected outright as an invalid lscc invocation.","triggerScenarios":"A transaction whose lsccFunc (first argument to lscc) is not one of the supported constants (e.g. lscc.GETCCINFO, GETCCDATA, GETDEPSPEC, or arbitrary strings) reaching commit validation.","commonSituations":"Directly invoking lscc via an SDK to query chaincode metadata (queries go through different paths in modern Fabric); malicious or experimental transactions calling unknown lscc functions; hand-crafted proposals.","solutions":["Do not invoke lscc directly for queries; use peer chaincode list / query commands or the appropriate channels (QueryInstalledChaincodes APIs)","Resubmit only deploy/upgrade lifecycle operations through lscc","Remove any custom tooling that sends arbitrary function names to lscc"],"exampleFix":"// before\npeer chaincode invoke -C mychannel -n lscc -c '{\"Args\":[\"getccdata\",\"mychannel\",\"mycc\"]}'\n// after\npeer chaincode list -C mychannel","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await lsccContract.submitTransaction(fn, ...);\n} catch (e) {\n  if (String(e).includes('committing an invocation of function')) {\n    // switch to supported query APIs instead of invoking lscc directly\n  }\n}","preventionTips":["Never invoke lscc with arbitrary function names","Use peer chaincode list / lifecycle query APIs for metadata","Restrict lifecycle invokes to deploy/upgrade tooling"],"tags":["hyperledger-fabric","vscc","lscc","invalid-invocation"],"backgroundTag":"invalid-lscc-function","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"}