hyperledger/fabric · error
unexpected chaincode spec type: %s
Error message
unexpected chaincode spec type: %s
What it means
Returned by ValidateLSCCInvocation when the deployment spec's chaincode spec type is not one of GOLANG, NODE, JAVA, or CAR. VSCC rejects deploys of chaincodes whose runtime type is unrecognized by the network's validation logic.
Source
Thrown at core/handlers/validation/builtin/v13/lscc_validation_logic.go:397
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))
}
// validate chaincode version
ccVersion := cdsArgs.ChaincodeSpec.ChaincodeId.Version
// it must comply with the lscc.ChaincodeVersionRegExp
if !lscc.ChaincodeVersionRegExp.MatchString(ccVersion) {View on GitHub (pinned to 2736b63f8f)
Solutions
- Set a supported ChaincodeSpec.Type when packaging
- Use a platform-supported language value in the deploy spec
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at core/handlers/validation/builtin/v13/lscc_validation_logic.go:397 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/54d8e4aef2141399.
Report an issue: GitHub.