{"record":{"id":"e9b5fa7ed7233249","repo":"nektos/act","slug":"insert-cache-w","errorCode":null,"errorMessage":"insert cache: %w","messagePattern":"insert cache: %w","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"pkg/artifactcache/handler.go","lineNumber":408,"sourceCode":"\t\t}\n\t\tif err := db.FindOne(cache,\n\t\t\tbolthold.Where(\"Key\").RegExp(re).\n\t\t\t\tAnd(\"Version\").Eq(version).\n\t\t\t\tAnd(\"Complete\").Eq(true).\n\t\t\t\tSortBy(\"CreatedAt\").Reverse()); err != nil {\n\t\t\tif errors.Is(err, bolthold.ErrNotFound) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"find cache: %w\", err)\n\t\t}\n\t\treturn cache, nil\n\t}\n\treturn nil, nil\n}\n\nfunc insertCache(db *bolthold.Store, cache *Cache) error {\n\tif err := db.Insert(bolthold.NextSequence(), cache); err != nil {\n\t\treturn fmt.Errorf(\"insert cache: %w\", err)\n\t}\n\t// write back id to db\n\tif err := db.Update(cache.ID, cache); err != nil {\n\t\treturn fmt.Errorf(\"write back id to db: %w\", err)\n\t}\n\treturn nil\n}\n\nfunc (h *Handler) useCache(id uint64) {\n\tdb, err := h.openDB()\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer db.Close()\n\tcache := &Cache{}\n\tif err := db.Get(id, cache); err != nil {\n\t\treturn\n\t}","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/artifactcache/handler.go#L390-L426","documentation":"insertCache persists a freshly uploaded cache entry into bolthold via db.Insert(bolthold.NextSequence(), cache). A failure here means the write transaction itself broke: database locked by another handle, disk full, or a corrupt/oversized bolt file. The upload may have streamed the file to disk fine, but the entry never becomes findable, so the cache silently 'does not save'.","triggerScenarios":"The final POST that commits a cache entry after upload (handler.go:239 path) while another act run holds the bolt write lock, the disk holding ~/.cache/act is full, or the .db file was corrupted by an earlier kill.","commonSituations":"Multiple parallel act jobs saving cache simultaneously to a shared host dir; CI hosts with small home partitions filling up; act killed -9 during a previous cache save.","solutions":["Free disk space on the volume holding the cache dir and retry the workflow","Serialize cache-saving jobs or give each run its own cache dir to avoid bolt write-lock contention","If corruption is suspected, delete the cache dir so act recreates the DB","Check for orphaned act processes still holding the file lock (lsof on the .db)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := insertCache(db, cache); err != nil {\n    // a failed save must not fail the job; cache is best-effort\n    log.Warnf(\"cache save failed: %v\", err)\n}","preventionTips":["Keep cache saves best-effort in wrapper code","Serialize cache writes across parallel jobs","Watch disk space; bolthold fails on ENOSPC mid-transaction"],"tags":["artifact-cache","bolthold","disk-full","database","act"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}