-
Notifications
You must be signed in to change notification settings - Fork 276
Closed
Labels
automatedIssues created by cagentIssues created by cagentkind/bugSomething isn't workingSomething isn't working
Description
🟡 medium - bug
File: cmd/root/api.go (line 70)
Code
if _, recordCleanup, err := setupRecordingProxy(f.recordPath, &f.runConfig); err != nil {
return err
} else {
defer func() {
if err := recordCleanup(); err != nil {
slog.Error("Failed to cleanup recording proxy", "error", err)
}
}()
}Problem
The recordCleanup() function, which is deferred, returns an error that is not checked or handled when setupRecordingProxy itself returns an error. This means that if setupRecordingProxy fails, the cleanup for a partially set up recording proxy might also fail silently, potentially leaving resources open or in an inconsistent state.
Suggested Fix
The error from recordCleanup() should be checked and handled, especially in the case where setupRecordingProxy already returned an error. It could be added to a slice of errors to be returned at the end of the function.
Found by nightly codebase scan
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
automatedIssues created by cagentIssues created by cagentkind/bugSomething isn't workingSomething isn't working