{"record":{"id":"df3d38bcbc329ba4","repo":"hyperledger/fabric","slug":"unknown-chaincodetype-s-df3d38","errorCode":null,"errorMessage":"unknown chaincodeType: %s","messagePattern":"unknown chaincodeType: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/container/dockercontroller/dockercontroller.go","lineNumber":199,"sourceCode":"\t/chaincode/start.sh --peer.address %[1]s\nelse\n\tcd /usr/local/src\n\tnpm start -- --peer.address %[1]s\nfi\n`\n\nfunc (vm *DockerVM) GetArgs(ccType string, peerAddress string) ([]string, error) {\n\t// language specific arguments, possibly should be pushed back into platforms, but were simply\n\t// ported from the container_runtime chaincode component\n\tswitch ccType {\n\tcase pb.ChaincodeSpec_GOLANG.String(), pb.ChaincodeSpec_CAR.String():\n\t\treturn []string{\"chaincode\", fmt.Sprintf(\"-peer.address=%s\", peerAddress)}, nil\n\tcase pb.ChaincodeSpec_JAVA.String():\n\t\treturn []string{\"/root/chaincode-java/start\", \"--peerAddress\", peerAddress}, nil\n\tcase pb.ChaincodeSpec_NODE.String():\n\t\treturn []string{\"/bin/sh\", \"-c\", fmt.Sprintf(nodeStartScript, peerAddress)}, nil\n\tdefault:\n\t\treturn nil, errors.Errorf(\"unknown chaincodeType: %s\", ccType)\n\t}\n}\n\nconst (\n\t// Mutual TLS auth client key and cert paths in the chaincode container\n\tTLSClientKeyPath      string = \"/etc/hyperledger/fabric/client.key\"\n\tTLSClientCertPath     string = \"/etc/hyperledger/fabric/client.crt\"\n\tTLSClientKeyFile      string = \"/etc/hyperledger/fabric/client_pem.key\"\n\tTLSClientCertFile     string = \"/etc/hyperledger/fabric/client_pem.crt\"\n\tTLSClientRootCertFile string = \"/etc/hyperledger/fabric/peer.crt\"\n)\n\nfunc (vm *DockerVM) GetEnv(ccid string, tlsConfig *ccintf.TLSConfig) []string {\n\t// common environment variables\n\t// FIXME: we are using the env variable CHAINCODE_ID to store\n\t// the package ID; in the legacy lifecycle they used to be the\n\t// same but now they are not, so we should use a different env\n\t// variable. However chaincodes built by older versions of the","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/container/dockercontroller/dockercontroller.go#L181-L217","documentation":"Thrown by DockerVM.GetArgs when the chaincode type string (ccType) does not match any supported ChaincodeSpec type (GOLANG/CAR, JAVA, NODE). GetArgs maps the language to the container start command; an unrecognized type has no launch command, so Start fails with 'could not get args'. The error embeds the offending type string via errors.Errorf.","triggerScenarios":"Starting a chaincode container with a ccType that is not one of GOLANG, CAR, JAVA, or NODE (case-sensitive comparison against pb.ChaincodeSpec_* strings), e.g. 'golang' lowercase, an empty string, or a custom/unknown language label from package metadata.","commonSituations":"Package metadata stored the type lowercase ('node' instead of 'NODE') in newer lifecycle flows; a typo in custom integration code calling Start/GetArgs directly; upgrading Fabric and deploying a chaincode type no longer supported (CAR removal).","solutions":["Normalize the chaincode type before calling Start (strings.ToUpper) so it matches the pb.ChaincodeSpec enum strings ('GOLANG','JAVA','NODE','CAR').","Check where the type originated (chaincode package metadata) and repackage with a supported --lang value.","If calling GetArgs/Start from custom code, pass pb.ChaincodeSpec_GOLANG.String() style values, not raw user input.","Inspect the error message for the exact offending type string to confirm a casing/spelling mismatch."],"exampleFix":"// before\nvm.Start(ccid, metadata.Type, peerConn) // metadata.Type = \"node\"\n// after\nvm.Start(ccid, strings.ToUpper(metadata.Type), peerConn) // \"NODE\"","handlingStrategy":"validation","validationCode":"func validChaincodeType(t string) error {\n\tswitch strings.ToUpper(t) {\n\tcase \"GOLANG\", \"JAVA\", \"NODE\", \"CAR\":\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"chaincode type %q not supported; use GOLANG, JAVA, NODE or CAR\", t)\n}\n// call before vm.Start(ccid, ccType, peerConn)","typeGuard":"func isKnownChaincodeType(t string) bool {\n\tswitch strings.ToUpper(t) {\n\tcase pb.ChaincodeSpec_GOLANG.String(), pb.ChaincodeSpec_JAVA.String(),\n\t\tpb.ChaincodeSpec_NODE.String(), pb.ChaincodeSpec_CAR.String():\n\t\treturn true\n\t}\n\treturn false\n}","tryCatchPattern":"if err := vm.Start(ccid, ccType, peerConn); err != nil {\n\tif strings.Contains(err.Error(), \"unknown chaincodeType\") {\n\t\t// normalize casing / fix package metadata then retry\n\t\treturn vm.Start(ccid, strings.ToUpper(ccType), peerConn)\n\t}\n\treturn err\n}","preventionTips":["Always pass ccType through strings.ToUpper before Start/GetArgs.","Store package metadata with canonical uppercase language names.","Add a unit test asserting every type your deployment flow emits maps to a GetArgs case."],"tags":["hyperledger-fabric","chaincode-type","invalid-argument","go"],"backgroundTag":"unknown-chaincode-type","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"}