hyperledger/fabric · error
could not find platform of type: %s
Error message
could not find platform of type: %s
What it means
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.
Source
Thrown at core/chaincode/platforms/platforms.go:119
// ----------------------------------------------------------------------------------------------------
// Finalize it
// ----------------------------------------------------------------------------------------------------
contents := strings.Join(buf, "\n")
logger.Debugf("\n%s", contents)
return contents, nil
}
func (r *Registry) StreamDockerBuild(ccType, path string, codePackage io.Reader, inputFiles map[string][]byte, tw *tar.Writer, client dcli.APIClient) error {
var err error
// ----------------------------------------------------------------------------------------------------
// Determine our platform driver from the spec
// ----------------------------------------------------------------------------------------------------
platform, ok := r.Platforms[ccType]
if !ok {
return fmt.Errorf("could not find platform of type: %s", ccType)
}
// ----------------------------------------------------------------------------------------------------
// First stream out our static inputFiles
// ----------------------------------------------------------------------------------------------------
for name, data := range inputFiles {
err = r.PackageWriter.Write(name, data, tw)
if err != nil {
return fmt.Errorf(`Failed to inject "%s": %s`, name, err)
}
}
var (
goVersion string
osVersion string
archVersion string
)
if ccType == pb.ChaincodeSpec_GOLANG.String() {View on GitHub (pinned to 2736b63f8f)
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.
Example fix
// before ccType := "nodejs" // not a registered key // after ccType := pb.ChaincodeSpec_NODE.String()
Defensive patterns
Strategy: validation
Validate before calling
const supportedTypes = ['GOLANG', 'NODE', 'CAR', 'JAVA'];
if (!supportedTypes.includes(spec.Type)) {
throw new Error(`platform not available for type: ${spec.Type}`);
} Type guard
function isRegisteredType(registry, ccType) {
return !!registry && !!registry.Platforms && Object.prototype.hasOwnProperty.call(registry.Platforms, ccType);
} Prevention
- 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
When it happens
Trigger: GenerateDockerBuild (or its anonymous caller) invoking StreamDockerBuild with a ccType absent from the registry — unsupported ChaincodeSpec type enum, empty type, or unregistered custom platform.
Common situations: Installing chaincode with an unsupported language value, Fabric builds with platform plugins disabled, or type strings altered by proxies/tools between client and peer.
Related errors
- Unknown chaincodeType: %s
- Failed to inject "%s": %s
- platform failed to create docker build options
- no DockerBuilder, cannot build
- Failed to generate platform-specific Dockerfile: %s
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/4a6dde06ec20bdd0.
Report an issue: GitHub.