{"record":{"id":"4dbed4ca00ea0853","repo":"AdguardTeam/AdGuardHome","slug":"creating-bucket-w","errorCode":null,"errorMessage":"creating bucket: %w","messagePattern":"creating bucket: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/aghuser/sessionstorage.go","lineNumber":362,"sourceCode":"}\n\n// store saves a web user session in the bbolt database.\nfunc (ds *DefaultSessionStorage) store(s *Session) (err error) {\n\ttx, err := ds.db.Begin(true)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"starting transaction: %w\", err)\n\t}\n\n\tneedRollback := true\n\tdefer func() {\n\t\tif needRollback {\n\t\t\terr = errors.WithDeferred(err, tx.Rollback())\n\t\t}\n\t}()\n\n\tbkt, err := tx.CreateBucketIfNotExists([]byte(bboltBucketSessions))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"creating bucket: %w\", err)\n\t}\n\n\terr = bkt.Put(s.Token[:], bboltEncode(s))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"putting data: %w\", err)\n\t}\n\n\tneedRollback = false\n\terr = tx.Commit()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"committing transaction: %w\", err)\n\t}\n\n\treturn nil\n}\n\n// FindByToken implements the [SessionStorage] interface for *DefaultSessionStorage.\nfunc (ds *DefaultSessionStorage) FindByToken(ctx context.Context, t SessionToken) (s *Session, err error) {","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/aghuser/sessionstorage.go#L344-L380","documentation":"store() could not create the 'sessions' bucket inside the writable transaction (tx.CreateBucketIfNotExists). bbolt fails here if the bucket name is invalid, the db is in a read-only transaction, or free-page allocation fails on a corrupted/full database.","triggerScenarios":"First session write on a fresh or damaged db where bucket creation fails; database file corrupted so page allocation errors.","commonSituations":"Corrupted db after unclean shutdown; insufficient disk space for page allocation; incompatible bbolt version reading the file.","solutions":["Free disk space / verify filesystem health","Validate the db with bbolt check; delete the sessions db if corrupt (it is rebuildable)","Recreate the work directory if the whole db is damaged"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// log and degrade: keep the in-memory session map even if persistence fails","preventionTips":["Watch disk usage","Run bbolt check in ops runbooks","Keep session db on local SSD"],"tags":["bbolt","bucket","transaction"],"backgroundTag":"database-write-failed","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}