{"record":{"id":"77e0872de311a98b","repo":"nats-io/nats-server","slug":"could-not-create-hash-v","errorCode":null,"errorMessage":"could not create hash: %v","messagePattern":"could not create hash: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/filestore.go","lineNumber":498,"sourceCode":"\n\t// Set flush in place to AsyncFlush which by default is false.\n\tfs.fip = !fcfg.AsyncFlush\n\n\t// Check if this is a new setup.\n\tmdir := filepath.Join(fcfg.StoreDir, msgDir)\n\todir := filepath.Join(fcfg.StoreDir, consumerDir)\n\tif err := os.MkdirAll(mdir, defaultDirPerms); err != nil {\n\t\treturn nil, fmt.Errorf(\"could not create message storage directory - %v\", err)\n\t}\n\tif err := os.MkdirAll(odir, defaultDirPerms); err != nil {\n\t\treturn nil, fmt.Errorf(\"could not create consumer storage directory - %v\", err)\n\t}\n\n\t// Create highway hash for message blocks. Use sha256 of directory as key.\n\tkey := sha256.Sum256([]byte(cfg.Name))\n\tfs.hh, err = highwayhash.NewDigest64(key[:])\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not create hash: %v\", err)\n\t}\n\n\tkeyFile := filepath.Join(fs.fcfg.StoreDir, JetStreamMetaFileKey)\n\t_, err = os.Stat(keyFile)\n\t// Either the file should exist (err=nil), or it shouldn't. Any other error is reported.\n\tif err != nil && !os.IsNotExist(err) {\n\t\treturn nil, err\n\t}\n\t// Make sure we do not have an encrypted store underneath of us but no main key.\n\tif fs.prf == nil && err == nil {\n\t\treturn nil, errNoMainKey\n\t} else if fs.prf != nil && err == nil {\n\t\t// If encryption is configured and the key file exists, recover our keys.\n\t\tif err = fs.recoverAEK(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n","sourceCodeStart":480,"sourceCodeEnd":516,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/filestore.go#L480-L516","documentation":"The file store initializes a HighwayHash digest for message block checksums using highwayhash.NewDigest64 with a SHA-256 key derived from the stream name. If that construction fails, the error is wrapped. This is rare and generally indicates a library/dependency problem rather than user misconfiguration.","triggerScenarios":"highwayhash.NewDigest64(key[:]) returns an error during file store creation (server/filestore.go:498).","commonSituations":"Corrupted or incompatible golang.org/x/crypto/highwayhash dependency/build; platform lacking the required SIMD/assembly support for the package.","solutions":["Rebuild/re-vendor dependencies (go mod tidy && go mod vendor) to get an intact highwayhash package","Update to a current NATS server version where the dependency is known-good","Report upstream with the wrapped error if it persists on supported platforms"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"fs, err := newFileStoreWithCreatedAndMode(fcfg, cfg, now, prf, oldprf, false)\nif err != nil {\n    if strings.Contains(err.Error(), \"could not create hash\") {\n        return fmt.Errorf(\"environment/dependency issue: %w\", err)\n    }\n    return err\n}","preventionTips":["Pin and verify vendor dependencies (go mod verify)","Run on supported platforms for the highwayhash assembly","Keep the NATS server version current"],"tags":["jetstream","filestore","hashing","dependency","go"],"backgroundTag":"hash-initialization-failed","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}