{"record":{"id":"ee158bc82a89ea62","repo":"nats-io/nats-server","slug":"unexpected-content-account-s","errorCode":null,"errorMessage":"unexpected content (account=%s)","messagePattern":"unexpected content \\(account=(.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/stream.go","lineNumber":9341,"sourceCode":"\tif _, err := os.Stat(sd); os.IsNotExist(err) {\n\t\tif err := os.MkdirAll(sd, defaultDirPerms); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not create snapshots directory - %v\", err)\n\t\t}\n\t}\n\tsdir, err := os.MkdirTemp(sd, \"snap-\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := os.Stat(sdir); os.IsNotExist(err) {\n\t\tif err := os.MkdirAll(sdir, defaultDirPerms); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not create snapshots directory - %v\", err)\n\t\t}\n\t}\n\tdefer os.RemoveAll(sdir)\n\n\tlogAndReturnError := func() error {\n\t\ta.mu.RLock()\n\t\terr := fmt.Errorf(\"unexpected content (account=%s)\", a.Name)\n\t\tif a.srv != nil {\n\t\t\ta.srv.Errorf(\"Stream restore failed due to %v\", err)\n\t\t}\n\t\ta.mu.RUnlock()\n\t\treturn err\n\t}\n\tsdirCheck := filepath.Clean(sdir) + string(os.PathSeparator)\n\n\t_, isClustered := jsa.jetStreamAndClustered()\n\tjsa.usageMu.RLock()\n\tselected, tier, hasTier := jsa.selectLimits(cfg.Replicas)\n\tjsa.usageMu.RUnlock()\n\treserved := int64(0)\n\tif hasTier {\n\t\tif isClustered {\n\t\t\tjs.mu.RLock()\n\t\t\t_, reserved = js.tieredStreamAndReservationCount(a.Name, tier, &cfg)\n\t\t\tjs.mu.RUnlock()","sourceCodeStart":9323,"sourceCodeEnd":9359,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/stream.go#L9323-L9359","documentation":"During account snapshot restore (used by JetStream account migration/clone), the temporary extraction directory contained entries other than the expected account/stores/consumers layout — the logAndReturnError closure in the snapshot processing reports 'unexpected content' with the account name. Means the snapshot archive is malformed or was produced by an incompatible server version.","triggerScenarios":"Thrown at server/stream.go:9341 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Regenerate the snapshot from a healthy source server","Ensure source and target nats-server versions match","Verify the snapshot file was not truncated or altered in transfer"],"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-08T10:18:20.063Z"}