{"record":{"id":"2d4dfb5ae027eb0d","repo":"nats-io/nats-server","slug":"ocsp-storage-directory-is-not-a-directory","errorCode":null,"errorMessage":"OCSP storage directory is not a directory","messagePattern":"OCSP storage directory is not a directory","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/ocsp.go","lineNumber":577,"sourceCode":"\t\t\t}\n\t\t}\n\t}\n\treturn tc, mon, nil\n}\n\nfunc (s *Server) setupOCSPStapleStoreDir() error {\n\topts := s.getOpts()\n\tstoreDir := opts.StoreDir\n\tif storeDir == _EMPTY_ {\n\t\treturn nil\n\t}\n\tstoreDir = filepath.Join(storeDir, defaultOCSPStoreDir)\n\tif stat, err := os.Stat(storeDir); os.IsNotExist(err) {\n\t\tif err := os.MkdirAll(storeDir, defaultDirPerms); err != nil {\n\t\t\treturn fmt.Errorf(\"could not create OCSP storage directory - %v\", err)\n\t\t}\n\t} else if stat == nil || !stat.IsDir() {\n\t\treturn fmt.Errorf(\"OCSP storage directory is not a directory\")\n\t}\n\treturn nil\n}\n\ntype tlsConfigKind struct {\n\ttlsConfig   *tls.Config\n\ttlsOpts     *TLSConfigOpts\n\tkind        string\n\tisLeafSpoke bool\n\tapply       func(*tls.Config)\n}\n\nfunc (s *Server) configureOCSP() []*tlsConfigKind {\n\tsopts := s.getOpts()\n\n\tconfigs := make([]*tlsConfigKind, 0)\n\n\tif config := sopts.TLSConfig; config != nil {","sourceCodeStart":559,"sourceCodeEnd":595,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/ocsp.go#L559-L595","documentation":"Thrown by setupOCSPStapleStoreDir when os.Stat on the OCSP staple store directory (server store_dir plus the default ocsp subdirectory) succeeds but reports a non-directory entry (or a nil FileInfo), i.e. the path exists but is a regular file, symlink target, socket, etc. rather than a directory. Only the 'exists but wrong type' case triggers it; a missing directory is created via MkdirAll instead.","triggerScenarios":"Thrown at server/ocsp.go:577 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove or rename the non-directory file occupying the OCSP store path (<store_dir>/jetstream-ocsp or the configured store_dir + default OCSP subdir) so the server can create the directory","Set store_dir to a location where the OCSP subdirectory can be created as a real directory","Fix permissions/ownership so the path can be replaced with a directory"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}