{"record":{"id":"7d1b1e5576c8b85e","repo":"hyperledger/fabric","slug":"platform-failed-to-create-docker-build-options","errorCode":null,"errorMessage":"platform failed to create docker build options","messagePattern":"platform failed to create docker build options","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/platforms/platforms.go","lineNumber":146,"sourceCode":"\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() {\n\t\tgoVersion, osVersion, archVersion, err = util.ParamsImage(client)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"get params docker image failed\")\n\t\t}\n\t}\n\n\tbuildOptions, err := platform.DockerBuildOptions(path, goVersion, osVersion, archVersion)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"platform failed to create docker build options\")\n\t}\n\n\toutput := &bytes.Buffer{}\n\tbuildOptions.InputStream = codePackage\n\tbuildOptions.OutputStream = output\n\n\terr = r.DockerBuild(buildOptions, client)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"docker build failed\")\n\t}\n\n\treturn writeBytesToPackage(\"binpackage.tar\", output.Bytes(), tw)\n}\n\nfunc writeBytesToPackage(name string, payload []byte, tw *tar.Writer) error {\n\terr := tw.WriteHeader(&tar.Header{\n\t\tName: name,\n\t\tSize: int64(len(payload)),","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/platforms/platforms.go#L128-L164","documentation":"StreamDockerBuild wraps an error from platform.DockerBuildOptions, which assembles the docker build options (path, goVersion, osVersion, archVersion) for the chaincode build. It means the platform could not construct a valid DockerBuildOptions struct for the given chaincode type/package. The build never reaches the docker daemon in this case.","triggerScenarios":"Calling StreamDockerBuild where the platform-specific DockerBuildOptions call returns an error, e.g. an unsupported or invalid ccType or invalid path/version inputs.","commonSituations":"Passing an unexpected chaincode type or empty path into the packaging pipeline; platform implementations (golang/car/java) rejecting inputs during chaincode install.","solutions":["Check the wrapped error to see which platform rejected the options","Validate ccType is one of the supported pb.ChaincodeSpec types","Verify the chaincode source path passed in is valid and non-empty","Ensure goVersion/osVersion/archVersion values are sane if supplied"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if ccType != pb.ChaincodeSpec_GOLANG.String() && ccType != pb.ChaincodeSpec_CAR.String() && ccType != pb.ChaincodeSpec_JAVA.String() {\n    return fmt.Errorf(\"unsupported chaincode type: %s\", ccType)\n}\nif path == \"\" {\n    return fmt.Errorf(\"chaincode path must not be empty\")\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n    return fmt.Errorf(\"build options rejected for type %s: %+v\", ccType, errors.Cause(err))\n}","preventionTips":["Only pass supported pb.ChaincodeSpec types into the packaging pipeline","Validate the chaincode source path before calling StreamDockerBuild","Check platform.DockerBuildOptions requirements for your chaincode type"],"tags":["docker","build","chaincode"],"backgroundTag":"docker-build-options-invalid","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"}