{"record":{"id":"484e7748c0bd0c30","repo":"hyperledger/fabric","slug":"container-exited-with-d","errorCode":null,"errorMessage":"container exited with %d","messagePattern":"container exited with (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/runtime_launcher.go","lineNumber":118,"sourceCode":"\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\n\tsuccess := true\n\tif err != nil && !alreadyStarted {","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/runtime_launcher.go#L100-L136","documentation":"The launched chaincode container exited with a non-registration outcome: the launcher always notifies the launch state with 'container exited with N' after Wait returns. A non-zero exit code means the chaincode process crashed or exited before registering with the peer.","triggerScenarios":"Runtime.Wait returns a nonzero exit code for the chaincode container — the chaincode binary terminated on startup (bad flags, unhandled panic, OOM kill, missing env vars).","commonSituations":"Chaincode crashes due to bad CORE_CHAINCODE_ID_NAME/address config; OOM-killed container; chaincode binary incompatible with the base image; unsupported platform (e.g., ARM without a matching binary).","solutions":["Read the chaincode container logs (docker logs <ccid>) for the crash reason","Fix chaincode startup configuration (CORE_CHAINCODE_ID_NAME, TLS env vars) and redeploy","Increase container memory limits / verify the binary runs in the container image","Rebuild the chaincode package for the correct architecture and commit it"],"exampleFix":"// before: mismatched env\nCORE_CHAINCODE_ID_NAME=wrongcc:1.0\n// after\nCORE_CHAINCODE_ID_NAME=mycc:1.0","handlingStrategy":"try-catch","validationCode":"// before invoking, sanity-check chaincode env config\nif os.Getenv(\"CORE_CHAINCODE_ID_NAME\") != \"mycc:1.0\" { return errors.New(\"chaincode id mismatch\") }","typeGuard":null,"tryCatchPattern":"err := launcher.Launch(ccid)\nvar exitErr interface{ ExitCode() int }\nif errors.As(err, &exitErr) && exitErr.ExitCode() != 0 {\n    // fetch docker logs for ccid, fix chaincode, redeploy\n}","preventionTips":["Always inspect chaincode container logs after launch failures","Set correct CORE_CHAINCODE_ID_NAME matching name:version","Right-size container memory to avoid OOM kills","Build chaincode binaries for the host architecture"],"tags":["chaincode","container","crash"],"backgroundTag":"chaincode-container-exited","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"}