{"record":{"id":"6ba6e40d525c916a","repo":"hyperledger/fabric","slug":"external-builder-s-failed","errorCode":null,"errorMessage":"external builder '%s' failed","messagePattern":"external builder '(.+?)' failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/container/externalbuilder/externalbuilder.go","lineNumber":309,"sourceCode":"\tcmd := b.NewCommand(detect, buildContext.SourceDir, buildContext.MetadataDir)\n\n\terr := b.runCommand(cmd)\n\tif err != nil {\n\t\tlogger.Debugf(\"builder '%s' detect failed: %s\", b.Name, err)\n\t\treturn false\n\t}\n\n\treturn true\n}\n\n// Build runs the `build` script.\nfunc (b *Builder) Build(buildContext *BuildContext) error {\n\tbuild := filepath.Join(b.Location, \"bin\", \"build\")\n\tcmd := b.NewCommand(build, buildContext.SourceDir, buildContext.MetadataDir, buildContext.BldDir)\n\n\terr := b.runCommand(cmd)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"external builder '%s' failed\", b.Name)\n\t}\n\n\treturn nil\n}\n\n// Release runs the `release` script.\nfunc (b *Builder) Release(buildContext *BuildContext) error {\n\trelease := filepath.Join(b.Location, \"bin\", \"release\")\n\n\t_, err := exec.LookPath(release)\n\tif err != nil {\n\t\tb.Logger.Debugf(\"Skipping release step for '%s' as no release binary found\", buildContext.CCID)\n\t\treturn nil\n\t}\n\n\tcmd := b.NewCommand(release, buildContext.BldDir, buildContext.ReleaseDir)\n\terr = b.runCommand(cmd)\n\tif err != nil {","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/container/externalbuilder/externalbuilder.go#L291-L327","documentation":"The external builder's `bin/build` script exited non-zero (or failed to run) during the build phase. Fabric wraps the underlying exec error with the builder's name so the failing builder is identifiable.","triggerScenarios":"Builder.Build() runs <builder>/bin/build with source, metadata, and output dirs; the script returns a non-zero exit status, is missing, or is not executable.","commonSituations":"Build script has a bug or unhandled dependency (missing docker, go toolchain, network fetch failure); bin/build lacks the executable bit; builder image/tooling version mismatch after upgrade.","solutions":["Run the builder's bin/build manually with the same arguments to see the underlying error","Ensure bin/build exists and is executable (chmod +x) inside the builder path","Fix the failing step in the build script (dependencies, toolchain, network access)"],"exampleFix":"// before\n#!/bin/sh\nnpm build\n// after\n#!/bin/sh\nset -eu\nnpm run build","handlingStrategy":"try-catch","validationCode":"buildBin := filepath.Join(builderPath, \"bin\", \"build\")\nif info, err := os.Stat(buildBin); err != nil || info.IsDir() {\n    return fmt.Errorf(\"builder %s missing executable bin/build\", builderPath)\n}\nif info.Mode()&0o111 == 0 { return fmt.Errorf(\"bin/build not executable\") }","typeGuard":null,"tryCatchPattern":"err := builder.Build(ctx)\nvar execErr *exec.ExitError\nif errors.As(err, &execErr) {\n    log.Errorf(\"builder %s build failed, exit=%d stderr=%s\", name, execErr.ExitCode(), captureStderr)\n}","preventionTips":["Smoke-test bin/build manually with sample source/metadata/bld dirs before deploying the builder","Always chmod +x builder scripts and pin shebangs","Pin and pre-pull toolchain dependencies so builds don't rely on network fetches"],"tags":["external-builder","build-failure","subprocess","chaincode"],"backgroundTag":"builder-script-failed","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"}