{"record":{"id":"b0dfac75f97f13aa","repo":"hyperledger/fabric","slug":"claimed-to-start-chaincode-container-for-s-but-co","errorCode":null,"errorMessage":"claimed to start chaincode container for %s but could not find handler","messagePattern":"claimed to start chaincode container for (.+?) but could not find handler","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/chaincode_support.go","lineNumber":96,"sourceCode":"\tUseGetMultipleKeys     bool\n\tMaxSizeGetMultipleKeys uint32\n}\n\n// Launch starts executing chaincode if it is not already running. This method\n// blocks until the peer side handler gets into ready state or encounters a fatal\n// error. If the chaincode is already running, it simply returns.\nfunc (cs *ChaincodeSupport) Launch(ccid string) (*Handler, error) {\n\tif h := cs.HandlerRegistry.Handler(ccid); h != nil && h.State() == Ready {\n\t\treturn h, nil\n\t}\n\n\tif err := cs.Launcher.Launch(ccid, cs); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"could not launch chaincode %s\", ccid)\n\t}\n\n\th := cs.HandlerRegistry.Handler(ccid)\n\tif h == nil {\n\t\treturn nil, errors.Errorf(\"claimed to start chaincode container for %s but could not find handler\", ccid)\n\t}\n\n\treturn h, nil\n}\n\n// LaunchInProc is a stopgap solution to be called by the inproccontroller to allow system chaincodes to register\nfunc (cs *ChaincodeSupport) LaunchInProc(ccid string) <-chan struct{} {\n\tlaunchStatus, ok := cs.HandlerRegistry.Launching(ccid)\n\tif ok {\n\t\tchaincodeLogger.Panicf(\"attempted to launch a system chaincode which has already been launched\")\n\t}\n\n\treturn launchStatus.Done()\n}\n\n// HandleChaincodeStream implements ccintf.HandleChaincodeStream for all vms to call with appropriate stream\nfunc (cs *ChaincodeSupport) HandleChaincodeStream(stream ccintf.ChaincodeStream) error {\n\tvar deserializerFactory privdata.IdentityDeserializerFactoryFunc = func(channelID string) msp.IdentityDeserializer {","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/chaincode_support.go#L78-L114","documentation":"After ChaincodeSupport.Launch successfully launches a chaincode (cs.Launcher.Launch returned no error), it looks up the connection handler in the HandlerRegistry. If no handler is registered despite the launcher claiming it started the container, the peer raises this error. It signals an internal race/state inconsistency: the chaincode container was started but never completed registration with the peer before the lookup.","triggerScenarios":"Launcher.Launch returns without error but the chaincode handler isn't in HandlerRegistry yet or ever: the chaincode process started but crashed before sending REGISTER, a launch timeout window expired, or an in-process/system chaincode failed to register via the inproccontroller path.","commonSituations":"Slow chaincode startup exceeding the launch timeout under heavy node load; chaincode image that starts but exits immediately; system chaincode misconfigured so its in-process registration never happens; concurrent invocations racing launch of the same ccid.","solutions":["Check the chaincode container logs to see why it exited or failed to send REGISTER after starting.","Retry the transaction/invocation once node load subsides if the cause was slow startup racing the launch timeout.","Verify the chaincode image's entrypoint and connection config so it actually connects to the peer instead of exiting.","Increase launch/startup allowances in your environment (resources for the chaincode container) and check peer logs for handler registration timing."],"exampleFix":"// before: chaincode container starts but resource limits kill it before registration\nresources:\n  limits:\n    memory: \"64Mi\"\n// after: raise limits so the chaincode lives long enough to register\nresources:\n  limits:\n    memory: \"512Mi\"","handlingStrategy":"retry","validationCode":"// Pre-warm the chaincode with a no-op invocation after deploy so registration completes\n// before real traffic: invoke a harmless query like GetHistory or an empty init function.","typeGuard":"func IsHandlerMissingError(err error) bool {\n\treturn err != nil && strings.Contains(err.Error(), \"could not find handler\")\n}","tryCatchPattern":"for attempt := 0; attempt < 3; attempt++ {\n    resp, err := contract.EvaluateTransaction(\"readAsset\", \"a1\")\n    if err != nil && IsHandlerMissingError(err) {\n        time.Sleep(time.Duration(attempt+1) * 2 * time.Second) // backoff for slow registration\n        continue\n    }\n    return resp, err\n}","preventionTips":["Pre-warm chaincode after deployment before serving production traffic.","Give chaincode containers adequate CPU/memory so startup is fast.","Avoid hammering a just-deployed chaincode with concurrent invocations.","Monitor chaincode container exits; an image that starts and dies will always hit this."],"tags":["hyperledger-fabric","chaincode","race-condition"],"backgroundTag":"chaincode-handler-not-found","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"}