{"record":{"id":"4a6dde06ec20bdd0","repo":"hyperledger/fabric","slug":"could-not-find-platform-of-type-s","errorCode":null,"errorMessage":"could not find platform of type: %s","messagePattern":"could not find platform of type: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/platforms/platforms.go","lineNumber":119,"sourceCode":"\n\t// ----------------------------------------------------------------------------------------------------\n\t// Finalize it\n\t// ----------------------------------------------------------------------------------------------------\n\tcontents := strings.Join(buf, \"\\n\")\n\tlogger.Debugf(\"\\n%s\", contents)\n\n\treturn contents, nil\n}\n\nfunc (r *Registry) StreamDockerBuild(ccType, path string, codePackage io.Reader, inputFiles map[string][]byte, tw *tar.Writer, client dcli.APIClient) error {\n\tvar err error\n\n\t// ----------------------------------------------------------------------------------------------------\n\t// Determine our platform driver from the spec\n\t// ----------------------------------------------------------------------------------------------------\n\tplatform, ok := r.Platforms[ccType]\n\tif !ok {\n\t\treturn fmt.Errorf(\"could not find platform of type: %s\", ccType)\n\t}\n\n\t// ----------------------------------------------------------------------------------------------------\n\t// First stream out our static inputFiles\n\t// ----------------------------------------------------------------------------------------------------\n\tfor name, data := range inputFiles {\n\t\terr = r.PackageWriter.Write(name, data, tw)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(`Failed to inject \"%s\": %s`, name, err)\n\t\t}\n\t}\n\n\tvar (\n\t\tgoVersion   string\n\t\tosVersion   string\n\t\tarchVersion string\n\t)\n\tif ccType == pb.ChaincodeSpec_GOLANG.String() {","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/platforms/platforms.go#L101-L137","documentation":"StreamDockerBuild determines the platform driver from the chaincode type by looking it up in Registry.Platforms. If the type is not registered, it cannot stream the build context and returns 'could not find platform of type'. This is the streaming-build analogue of the 'Unknown chaincodeType' error.","triggerScenarios":"GenerateDockerBuild (or its anonymous caller) invoking StreamDockerBuild with a ccType absent from the registry — unsupported ChaincodeSpec type enum, empty type, or unregistered custom platform.","commonSituations":"Installing chaincode with an unsupported language value, Fabric builds with platform plugins disabled, or type strings altered by proxies/tools between client and peer.","solutions":["Use a registered chaincode type (GOLANG, NODE, etc. as supported by this peer build).","Correct the ChaincodeSpec.Type in the install request.","Register the required platform in the Registry if running a customized peer.","Check peer logs/build flags to confirm the platform was compiled in."],"exampleFix":"// before\nccType := \"nodejs\" // not a registered key\n// after\nccType := pb.ChaincodeSpec_NODE.String()","handlingStrategy":"validation","validationCode":"const supportedTypes = ['GOLANG', 'NODE', 'CAR', 'JAVA'];\nif (!supportedTypes.includes(spec.Type)) {\n  throw new Error(`platform not available for type: ${spec.Type}`);\n}","typeGuard":"function isRegisteredType(registry, ccType) {\n  return !!registry && !!registry.Platforms && Object.prototype.hasOwnProperty.call(registry.Platforms, ccType);\n}","tryCatchPattern":null,"preventionTips":["Use only chaincode types compiled into the peer","Validate the type client-side before install","Avoid string manipulation of type values by middleware","Confirm platform plugins are enabled in custom peer builds"],"tags":["chaincode","docker","build","unsupported-type"],"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"}