You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(python): table.optimize() errors forever once a tagged version is older than the cleanup cutoff (and skips the index step) #4543
0.40.0 (cause confirmed on main @ 0aa842b by reading the source)
What happened?
table.optimize(cleanup_older_than=...) raises as soon as any tagged version is older than the cleanup cutoff
(7 days by default):
Cleanup error: 1 tagged version(s) have been marked for cleanup. Either set `error_if_tagged_old_versions=false`
or delete the following tag(s)...: {"release-1": 2}
The docs (docs/web/management/table.mdx, "Tagged versions are exempt from cleanup... retained regardless of age,
and its files are not removed by optimize()") say tagged versions are retained. Expected: optimize()
succeeds, keeps the tagged version, and finishes the index step.
Because optimize runs compact, then prune, then index optimize, the prune error means the index step is skipped:
the table is left half-optimized (fragments 4 -> 2, unindexed rows stay at 3), and every later optimize() fails
the same way until the tag is deleted. After deleting the tag the same call succeeds and unindexed rows drop to 0.
Cause: error_if_tagged_old_versions: None is hard-coded where optimize prunes (python/src/table.rs,
nodejs/src/table.rs, rust/lancedb/src/table/optimize.rs) and Lance's cleanup defaults it to true
(unwrap_or(true)).
Activity
wjones127 commentedon Oct 15, 2026
Agreed this seems like a problem.
avanish-garg commentedon Oct 16, 2026
Thanks @wjones127!
The PR is ready for review!
fix: keep tagged versions when pruning in optimize (#4544)