nektos/act · error

insert cache: %w

Error message

insert cache: %w

What it means

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'.

Source

Thrown at pkg/artifactcache/handler.go:408

		}
		if err := db.FindOne(cache,
			bolthold.Where("Key").RegExp(re).
				And("Version").Eq(version).
				And("Complete").Eq(true).
				SortBy("CreatedAt").Reverse()); err != nil {
			if errors.Is(err, bolthold.ErrNotFound) {
				continue
			}
			return nil, fmt.Errorf("find cache: %w", err)
		}
		return cache, nil
	}
	return nil, nil
}

func insertCache(db *bolthold.Store, cache *Cache) error {
	if err := db.Insert(bolthold.NextSequence(), cache); err != nil {
		return fmt.Errorf("insert cache: %w", err)
	}
	// write back id to db
	if err := db.Update(cache.ID, cache); err != nil {
		return fmt.Errorf("write back id to db: %w", err)
	}
	return nil
}

func (h *Handler) useCache(id uint64) {
	db, err := h.openDB()
	if err != nil {
		return
	}
	defer db.Close()
	cache := &Cache{}
	if err := db.Get(id, cache); err != nil {
		return
	}

View on GitHub (pinned to 4f41128141)

Solutions

  1. Free disk space on the volume holding the cache dir and retry the workflow
  2. Serialize cache-saving jobs or give each run its own cache dir to avoid bolt write-lock contention
  3. If corruption is suspected, delete the cache dir so act recreates the DB
  4. Check for orphaned act processes still holding the file lock (lsof on the .db)
Defensive patterns

Strategy: try-catch

Try / catch

if err := insertCache(db, cache); err != nil {
    // a failed save must not fail the job; cache is best-effort
    log.Warnf("cache save failed: %v", err)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of nektos/act@4f41128141 (2026-08-15). Data as JSON: /api/errors/e9b5fa7ed7233249. Report an issue: GitHub.