{"record":{"id":"91bea7f14e80dadd","repo":"nats-io/nats-server","slug":"error-setting-up-delete-request-handling-v","errorCode":null,"errorMessage":"error setting up delete request handling: %v","messagePattern":"error setting up delete request handling: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/accounts.go","lineNumber":4620,"sourceCode":"\t\t\ts.Debugf(\"DirResolver - Pack request hash %x - finished responding with hash %x\", theirHash, ourHash)\n\t\t\ts.sendInternalMsgLocked(reply, _EMPTY_, nil, []byte{})\n\t\t}\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"error setting up pack request handling: %v\", err)\n\t}\n\t// respond to list requests with one message containing all account ids\n\tif _, err := s.sysSubscribe(accListReqSubj, func(_ *subscription, _ *client, _ *Account, _, reply string, _ []byte) {\n\t\thandleListRequest(dr.DirJWTStore, s, reply)\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"error setting up list request handling: %v\", err)\n\t}\n\tif _, err := s.sysSubscribe(accDeleteReqSubj, func(_ *subscription, c *client, _ *Account, _, reply string, msg []byte) {\n\t\t// As this is a raw message, we need to extract payload and only decode claims from it,\n\t\t// in case request is sent with headers.\n\t\t_, msg = c.msgParts(msg)\n\t\thandleDeleteRequest(dr.DirJWTStore, s, msg, reply)\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"error setting up delete request handling: %v\", err)\n\t}\n\t// embed pack responses into store\n\tif _, err := s.sysSubscribe(packRespIb, func(_ *subscription, _ *client, _ *Account, _, _ string, msg []byte) {\n\t\thash := dr.DirJWTStore.Hash()\n\t\tif len(msg) == 0 { // end of response stream\n\t\t\ts.Debugf(\"DirResolver - Merging finished and resulting in: %x\", dr.DirJWTStore.Hash())\n\t\t\treturn\n\t\t} else if err := dr.DirJWTStore.Merge(string(msg)); err != nil {\n\t\t\ts.Errorf(\"DirResolver - Merging resulted in error: %v\", err)\n\t\t} else {\n\t\t\ts.Debugf(\"DirResolver - Merging succeeded and changed %x to %x\", hash, dr.DirJWTStore.Hash())\n\t\t}\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"error setting up pack response handling: %v\", err)\n\t}\n\t// periodically send out pack message\n\tquit := s.quitCh\n\ts.startGoRoutine(func() {","sourceCodeStart":4602,"sourceCodeEnd":4638,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/accounts.go#L4602-L4638","documentation":"Returned by DirAccResolver setup when the subscription handling account-delete requests (accDeleteReqSubj) cannot be created. The handler decodes the raw claim and removes the account from the directory store; without it delete propagation in the cluster breaks, so setup fails fast.","triggerScenarios":"sysSubscribe(accDeleteReqSubj, ...) returning an error during resolver startup — eventing/system client not ready or invalid system setup.","commonSituations":"Starting a server with a dir resolver before the system account exists; shutting down the server concurrently with resolver setup.","solutions":["Configure the system account correctly so internal subscriptions work.","Check the wrapped error for the precise subscription failure reason.","Avoid starting/stopping the server and resolver concurrently.","Validate that the resolver's directory is writable and options are sane before Start()."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if !systemAccountConfigured(srv) {\n    return fmt.Errorf(\"delete request handling requires eventing/system account\")\n}","typeGuard":null,"tryCatchPattern":"if err := dr.Start(); err != nil {\n    if strings.Contains(err.Error(), \"error setting up delete request handling\") {\n        log.Errorf(\"resolver delete subscription failed: %v\", err)\n    }\n}","preventionTips":["Configure the system account before enabling resolver features.","Don't interleave server Stop() with resolver Start().","Check the inner error for the true cause.","Run startup integration tests covering resolver setup."],"tags":["nats-server","account-resolver","subscription","delete-request"],"backgroundTag":"internal-subscription-setup-failed","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}