hyperledger/fabric · error · VSCCEndorsementPolicyError

VSCC error: invocation of lscc(%s) does not have appropriate

Error message

VSCC error: invocation of lscc(%s) does not have appropriate arguments

What it means

After unmarshaling the ChaincodeDeploymentSpec, VSCC checks that the spec, its ChaincodeSpec, ChaincodeId, the ChaincodeActionPayload action and its ProposalResponsePayload are all non-nil. Any missing piece means the lscc invocation is structurally incomplete, so the transaction is rejected as a policy error.

Source

Thrown at core/handlers/validation/builtin/v12/validation_logic.go:534

		logger.Debugf("VSCC info: validating invocation of lscc function %s on arguments %#v", lsccFunc, lsccArgs)

		if len(lsccArgs) < 2 {
			return policyErr(fmt.Errorf("Wrong number of arguments for invocation lscc(%s): expected at least 2, received %d", lsccFunc, len(lsccArgs)))
		}

		if (!ac.PrivateChannelData() && len(lsccArgs) > 5) ||
			(ac.PrivateChannelData() && len(lsccArgs) > 6) {
			return policyErr(fmt.Errorf("Wrong number of arguments for invocation lscc(%s): received %d", lsccFunc, len(lsccArgs)))
		}

		cdsArgs, err := protoutil.UnmarshalChaincodeDeploymentSpec(lsccArgs[1])
		if err != nil {
			return policyErr(fmt.Errorf("GetChaincodeDeploymentSpec error %s", err))
		}

		if cdsArgs == nil || cdsArgs.ChaincodeSpec == nil || cdsArgs.ChaincodeSpec.ChaincodeId == nil ||
			cap.Action == nil || cap.Action.ProposalResponsePayload == nil {
			return policyErr(fmt.Errorf("VSCC error: invocation of lscc(%s) does not have appropriate arguments", lsccFunc))
		}

		switch cdsArgs.ChaincodeSpec.Type.String() {
		case "GOLANG", "NODE", "JAVA", "CAR":
		default:
			return policyErr(fmt.Errorf("unexpected chaincode spec type: %s", cdsArgs.ChaincodeSpec.Type.String()))
		}

		// validate chaincode name
		ccName := cdsArgs.ChaincodeSpec.ChaincodeId.Name
		// it must comply with the lscc.ChaincodeNameRegExp
		if !lscc.ChaincodeNameRegExp.MatchString(ccName) {
			return policyErr(errors.Errorf("invalid chaincode name '%s'", ccName))
		}
		// it can't match the name of one of the system chaincodes
		if _, in := systemChaincodeNames[ccName]; in {
			return policyErr(errors.Errorf("chaincode name '%s' is reserved for system chaincodes", ccName))
		}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Ensure the signed ChaincodeActionPayload includes a ProposalResponsePayload with a non-nil Action (use protoutil.GetProposalResponsePayload helpers when building the transaction).
  2. Confirm ChaincodeDeploymentSpec.ChaincodeSpec.ChaincodeId (name/version/path) is populated before submitting the deploy/upgrade.
  3. Update the SDK or transaction-building code to a version that correctly assembles the full action payload.

Example fix

// before: submitting action without proposal response payload
cap.Action = nil
// after: attach the endorsed proposal response payload
cap.Action = &pb.ChaincodeEndorsedAction{
    ProposalResponsePayload: prpBytes,
    Endorsements:            endorsements,
}
Defensive patterns

Strategy: validation

Validate before calling

if cds == nil || cds.ChaincodeSpec == nil || cds.ChaincodeSpec.ChaincodeId == nil ||
    cap.Action == nil || cap.Action.ProposalResponsePayload == nil {
    return errors.New("incomplete lscc invocation payload")
}

Type guard

func hasCompleteLsccPayload(cds *pb.ChaincodeDeploymentSpec, cap *pb.ChaincodeActionPayload) bool {
    return cds != nil && cds.ChaincodeSpec != nil && cds.ChaincodeSpec.ChaincodeId != nil &&
        cap != nil && cap.Action != nil && cap.Action.ProposalResponsePayload != nil
}

Try / catch

if !hasCompleteLsccPayload(cdsArgs, cap) {
    logger.Warn("lscc invocation missing spec/action payload; rejecting")
    return policyErr(errors.New("incomplete lscc invocation"))
}

Prevention

When it happens

Trigger: An lscc transaction whose deployment spec lacks ChaincodeSpec/ChaincodeId, or whose ChaincodeActionPayload has a nil Action or nil Action.ProposalResponsePayload — e.g. an endorsement response payload was never attached or was stripped.

Common situations: Malformed transactions built by custom scripts or buggy SDK versions that omit the proposal response payload in the action; tampered transactions during commit-time validation; partial payload assembly in custom endorsement flows.

Related errors


AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04). Data as JSON: /api/errors/59f6bd3f39669512. Report an issue: GitHub.