{"record":{"id":"79694ac7976ebaed","repo":"hyperledger/fabric","slug":"failed-to-wait-on-container-exit","errorCode":null,"errorMessage":"failed to wait on container exit","messagePattern":"failed to wait on container exit","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/runtime_launcher.go","lineNumber":116,"sourceCode":"\n\t\t\t// default peer-as-server model... compute connection information for CC callback\n\t\t\t// and proceed to launch chaincode\n\t\t\tccinfo, err := r.ChaincodeClientInfo(ccid)\n\t\t\tif err != nil {\n\t\t\t\tstartFailCh <- errors.WithMessage(err, \"could not get connection info\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif ccinfo == nil {\n\t\t\t\tstartFailCh <- errors.New(\"could not get connection info\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err = r.Runtime.Start(ccid, ccinfo); err != nil {\n\t\t\t\tstartFailCh <- errors.WithMessage(err, \"error starting container\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\texitCode, err := r.Runtime.Wait(ccid)\n\t\t\tif err != nil {\n\t\t\t\tlaunchState.Notify(errors.Wrap(err, \"failed to wait on container exit\"))\n\t\t\t}\n\t\t\tlaunchState.Notify(errors.Errorf(\"container exited with %d\", exitCode))\n\t\t}()\n\t}\n\n\tvar err error\n\tselect {\n\tcase <-launchState.Done():\n\t\terr = errors.WithMessage(launchState.Err(), \"chaincode registration failed\")\n\tcase err = <-startFailCh:\n\t\tlaunchState.Notify(err)\n\t\tr.Metrics.LaunchFailures.With(\"chaincode\", ccid).Add(1)\n\tcase <-timeoutCh:\n\t\terr = errors.Errorf(\"timeout expired while starting chaincode %s for transaction\", ccid)\n\t\tlaunchState.Notify(err)\n\t\tr.Metrics.LaunchTimeouts.With(\"chaincode\", ccid).Add(1)\n\t}\n","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/runtime_launcher.go#L98-L134","documentation":"After the container was started, r.Runtime.Wait(ccid) failed, so the launcher cannot determine the container's exit code. The container runtime (Docker) call itself errored, which is wrapped and reported as the launch result.","triggerScenarios":"Runtime.Wait returns an error while the launcher goroutine blocks on container exit — e.g., Docker daemon unavailable or the container record disappeared.","commonSituations":"Docker daemon restarted or unreachable mid-launch; container removed by an external cleaner while the peer waited; docker socket permission issues on the peer host.","solutions":["Verify Docker is running and the peer's docker socket access works (docker ps from the peer's environment)","Restart the peer to re-establish the Docker client connection","Check for container garbage-collection/cleanup jobs removing containers mid-run","Inspect peer logs for the wrapped underlying Docker error to pinpoint the runtime failure"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure Docker is reachable from the peer host before launch\nexec.Command(\"docker\", \"info\").Run() // must succeed","typeGuard":null,"tryCatchPattern":"if err := launcher.Launch(ccid); err != nil && strings.Contains(err.Error(), \"failed to wait on container exit\") {\n    // check Docker daemon health, then retry Launch\n}","preventionTips":["Monitor Docker daemon health on peer hosts","Avoid external jobs deleting containers while the peer runs","Grant the peer's docker socket mount correct permissions","Pin a compatible Docker version for your Fabric release"],"tags":["docker","container","chaincode"],"backgroundTag":"docker-daemon-unavailable","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"}