nats-io/nats-server · error

the path [%s] doesn't exist

Error message

the path [%s] doesn't exist

What it means

Directory JWT store path validation: os.Stat returned ENOENT for the resolved absolute path, so the configured resolver directory (or file) does not exist on disk.

Source

Thrown at server/dirstore.go:53

const (
	fileExtension = ".jwt"
)

// validatePathExists checks that the provided path exists and is a dir if requested
func validatePathExists(path string, dir bool) (string, error) {
	if path == _EMPTY_ {
		return _EMPTY_, errors.New("path is not specified")
	}

	abs, err := filepath.Abs(path)
	if err != nil {
		return _EMPTY_, fmt.Errorf("error parsing path [%s]: %v", abs, err)
	}

	var finfo os.FileInfo
	if finfo, err = os.Stat(abs); err != nil {
		if os.IsNotExist(err) {
			return _EMPTY_, fmt.Errorf("the path [%s] doesn't exist", abs)
		}
		return _EMPTY_, fmt.Errorf("error accessing path [%s]: %v", abs, err)
	}

	mode := finfo.Mode()
	if dir && mode.IsRegular() {
		return _EMPTY_, fmt.Errorf("the path [%s] is not a directory", abs)
	}

	if !dir && mode.IsDir() {
		return _EMPTY_, fmt.Errorf("the path [%s] is not a file", abs)
	}

	return abs, nil
}

// ValidateDirPath checks that the provided path exists and is a dir
func validateDirPath(path string) (string, error) {

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Create the directory before starting the server
  2. Point the config at an existing path
  3. Fix typos in the resolver path
Defensive patterns

Strategy: validation

When it happens

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