{"record":{"id":"cd1abecd00d64226","repo":"nats-io/nats-server","slug":"could-not-create-ocsp-storage-directory-v","errorCode":null,"errorMessage":"could not create OCSP storage directory - %v","messagePattern":"could not create OCSP storage directory - (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/ocsp.go","lineNumber":574,"sourceCode":"\t\t\t// GetClientCertificate returns a certificate that's presented to a server.\n\t\t\ttc.GetClientCertificate = func(info *tls.CertificateRequestInfo) (*tls.Certificate, error) {\n\t\t\t\treturn &cert, nil\n\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","sourceCodeStart":556,"sourceCodeEnd":592,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/ocsp.go#L556-L592","documentation":"setupOCSPStapleStoreDir: the OCSP cache directory (<store_dir>/jetstream/ocsp) did not exist and os.MkdirAll failed (permissions, read-only filesystem, or a conflicting file path). The underlying mkdir error is included.","triggerScenarios":"Thrown at server/ocsp.go:574 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix filesystem permissions on the store dir and retry startup","Ensure store_dir points to a writable location with no file/name collision"],"exampleFix":null,"handlingStrategy":"fallback","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-08T10:18:20.063Z"}