EmbeddingServer finalizeEmbeddingServer silently ignores errors
@Shashank-Panda is already working on this.
Since Jun 11, 2026.
- Dominant language
- Go
- Stars
- 2.2k
- Forks
- 300
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 184
Description
Summary
The finalizeEmbeddingServer method performs cleanup actions but returns void, silently discarding errors from status updates. If the status update fails, the finalizer is still removed by the caller and the object is deleted without the final status being persisted.
Severity: SHOULD FIX
Area: Controller Error Handling
Breaking: No
Location
cmd/thv-operator/controllers/embeddingserver_controller.go:1053-1067
Problem
func (r *EmbeddingServerReconciler) finalizeEmbeddingServer(
ctx context.Context, es *v1alpha1.EmbeddingServer) {
// Update status
_ = r.Status().Update(ctx, es) // error ignored
r.Recorder.Eventf(es, ...)
}
If the status update fails (e.g., conflict, network error), the finalizer is still removed by the caller. The object is deleted without the final status being persisted.
Impact
- Final status update may be lost silently
- No retry mechanism for failed status updates during finalization
- Observability gap: the last status of a deleted EmbeddingServer may not reflect the actual cleanup outcome
- If cleanup involves more than just status updates in the future, errors from those operations would also be silently ignored
Recommended Fix
-
Change
finalizeEmbeddingServerto return an error:func (r *EmbeddingServerReconciler) finalizeEmbeddingServer( ctx context.Context, es *v1alpha1.EmbeddingServer) error { if err := r.Status().Update(ctx, es); err != nil { return fmt.Errorf("updating final status: %w", err) } r.Recorder.Eventf(es, ...) return nil } -
Handle the error in the caller — if finalization fails, requeue instead of removing the finalizer:
if err := r.finalizeEmbeddingServer(ctx, es); err != nil { return ctrl.Result{}, err // requeue; finalizer stays } // Only remove finalizer after successful finalization
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.