storeOptions checked the NATS credentials and called os.Exit(1) on an
error. ReconnectedCB calls Init, and Init runs storeOptions again. If
a reconnect happened while a rotated .creds file was only partly
written, the service stopped. In the same path, nats.UserCredentials
reads the file once when the option is applied. When this read
failed, the error was ignored and the connection had no credentials.
Now only the first call checks the credentials, at startup. Later
calls do not check the file. For a file, they set the JWT callbacks
without a read. The callbacks read the file on each connect, so a
partly written file fails only that connect attempt, and NATS
retries it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>