nats-io/nats-server · error

line in package didn't contain 2 entries: %q

Error message

line in package didn't contain 2 entries: %q

What it means

DirJWTStore.Merge: a non-blank line of the pushed JWT package did not split on '|' into exactly pubKey|jwt parts, so the package format is invalid and the merge aborts.

Source

Thrown at server/dirstore.go:329

	})
	if packMsg != nil {
		cb(strings.Join(packMsg, "\n"))
	}
	return err
}

// Merge takes the JWTs from package and adds them to the store
// Merge is destructive in the sense that it doesn't check if the JWT
// is newer or anything like that.
func (store *DirJWTStore) Merge(pack string) error {
	newJWTs := strings.Split(pack, "\n")
	for _, line := range newJWTs {
		if line == _EMPTY_ { // ignore blank lines
			continue
		}
		split := strings.Split(line, "|")
		if len(split) != 2 {
			return fmt.Errorf("line in package didn't contain 2 entries: %q", line)
		}
		pubKey := split[0]
		if !nkeys.IsValidPublicAccountKey(pubKey) {
			return fmt.Errorf("key to merge is not a valid public account key")
		}
		if err := store.saveIfNewer(pubKey, split[1]); err != nil {
			return err
		}
	}
	return nil
}

func (store *DirJWTStore) Reload() error {
	store.Lock()
	exp := store.expiration
	if exp == nil || store.readonly {
		store.Unlock()
		return nil

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Ensure each package line is '<public key>|<JWT>'
  2. Regenerate the package from a compatible nats resolver export
  3. Strip corrupted lines from the package
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/dirstore.go:329 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/7c034a1e9c74389f. Report an issue: GitHub.