Skip to content

[bug] Ignored error from cleanup function in recording proxy #1977

@docker-agent

Description

@docker-agent

🟠 high - bug

File: cmd/root/api.go (line 74)

Code

} else {
	defer func() {
		if err := recordCleanup(); err != nil {
			slog.Error("Failed to cleanup recording proxy", "error", err)
		}
	}()
}

Problem

Similar to the setupFakeProxy cleanup, the recordCleanup function's error is only logged and not propagated. This can lead to silent failures in resource deallocation, potentially leaving behind open files or other system resources.

Suggested Fix

The error returned by recordCleanup() should be handled. It should be returned from runAPICommand or added to a list of errors if multiple cleanup functions are deferred and can fail.


Found by nightly codebase scan

Metadata

Metadata

Assignees

No one assigned

    Labels

    automatedIssues created by cagentkind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions