{"record":{"id":"d67ffe543dd6713a","repo":"AdguardTeam/AdGuardHome","slug":"committing-transaction-w","errorCode":null,"errorMessage":"committing transaction: %w","messagePattern":"committing transaction: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/aghuser/sessionstorage.go","lineNumber":181,"sourceCode":"\tif bkt == nil {\n\t\treturn nil\n\t}\n\n\tremoved, err := ds.processSessions(ctx, bkt)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"processing sessions: %w\", err)\n\t}\n\n\tif removed == 0 {\n\t\tds.logger.DebugContext(ctx, \"loading sessions from db\", \"stored\", len(ds.sessions))\n\n\t\treturn nil\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\tds.logger.DebugContext(\n\t\tctx,\n\t\t\"loading sessions from db\",\n\t\t\"stored\", len(ds.sessions),\n\t\t\"removed\", removed,\n\t)\n\n\treturn nil\n}\n\n// processSessions iterates over the sessions bucket and loads or removes\n// sessions as needed.\nfunc (ds *DefaultSessionStorage) processSessions(\n\tctx context.Context,\n\tbkt *bbolt.Bucket,\n) (removed int, err error) {","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/aghuser/sessionstorage.go#L163-L199","documentation":"bbolt failed to commit the write transaction that persisted removals of expired/invalid sessions during startup load. The commit happened because processSessions removed at least one stale session (removed > 0).","triggerScenarios":"tx.Commit fails after invalid sessions were deleted: underlying I/O error on the database file (disk full, ENOSPC), file removed underneath the process, or the transaction was already rolled back/closed.","commonSituations":"Disk-full conditions in the data directory; the sessions file deleted or replaced while the app was starting; hardware/filesystem errors on the volume holding the db.","solutions":["Check disk space on the volume holding sessions.db (df -h) and free space","Verify the database file still exists and is writable by the service user","If the file was replaced mid-startup, restart the service after the replacement settles","Run filesystem checks if I/O errors persist"],"exampleFix":"# before\n# df shows 100% on /var\n# after\n# free space, then restart the service","handlingStrategy":"retry","validationCode":"if avail := diskFree(sessionsDir); avail < minRequiredBytes { return fmt.Errorf(\"low disk: %d free\", avail) }","typeGuard":null,"tryCatchPattern":"if err := ds.loadSessions(ctx); err != nil {\n    if errors.Is(err, syscall.ENOSPC) { free space; retry startup }\n}","preventionTips":["Monitor disk space on the data volume","Keep sessions.db on a volume with headroom alerts"],"tags":["bbolt","database","commit","disk-full","io"],"backgroundTag":"database-commit-failed","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}