nats-io/nats-server · error

cdr.Error

Error message

cdr.Error

What it means

In the async consumer-cleanup goroutine, the JS API consumer-delete response arrived but carried a non-nil Error field — the remote/account delete of the source consumer failed (e.g. not found, permissions, server error). The failure is logged with full account/stream/consumer context; the goroutine exits without retry.

Source

Thrown at server/stream.go:3066

			default:
			}
		})
		if err != nil {
			warn(err)
			return
		}
		defer acc.unsubscribeInternal(cdSub)

		// Send the delete request.
		err = s.sendInternalAccountMsgWithReply(acc, subject, reply, nil, nil, false)
		if err != nil {
			warn(err)
			return
		}
		select {
		case cdr := <-respCh:
			if cdr.Error != nil {
				warn(cdr.Error)
			}
		case <-time.After(sourceHealthCheckInterval):
			warn(errors.New("timed out"))
		}
	}()
}

// Small helper to return the Name field from mset.cfg, protected by
// the mset.cfgMu mutex. This is simply because we have several places
// in consumer.go where we need it.
func (mset *stream) getCfgName() string {
	mset.cfgMu.RLock()
	defer mset.cfgMu.RUnlock()
	return mset.cfg.Name
}

// Purge will remove all messages from the stream and underlying store based on the request.
func (mset *stream) purge(preq *JSApiStreamPurgeRequest) (purged uint64, err error) {

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Inspect cdr.Error to identify why the remote delete failed
  2. Delete the leftover consumer manually via the JS API if it persists
  3. Check cross-account permissions and remote server health for mirrors/sources
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at server/stream.go:3066 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02). Data as JSON: /api/errors/a30ad2706dd5afde. Report an issue: GitHub.