Describe the bug
trust-tunnel-agent swallows errors returned by runServer in the Cobra command handler. If the server fails to start, the error is printed to stderr, but RunE still returns nil, so the process exits successfully.
This can make container runtimes, scripts, CI jobs, or supervisors treat a failed agent startup as healthy.
Code path
In cmd/trust-tunnel-agent/app/cmd.go:
if err := runServer(&options); err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
}
return nil
runServer returns server.Start(opt), and server.Start returns errors from ListenAndServe, ListenAndServeTLS, or TLS/config setup. Those errors should propagate back to Cobra instead of being ignored.
Expected behavior
If the agent cannot start, the command should return a non-nil error and exit with a non-zero status.
For example:
if err := runServer(&options); err != nil {
return err
}
return nil
Impact
Startup failures such as an invalid listen address, port already in use, or TLS file/config errors can be reported as successful process exits. This is especially problematic when the agent is launched by Kubernetes, Docker, systemd, or automation scripts that rely on exit status.
Environment
- Repository: current
main
- File:
cmd/trust-tunnel-agent/app/cmd.go
Describe the bug
trust-tunnel-agentswallows errors returned byrunServerin the Cobra command handler. If the server fails to start, the error is printed to stderr, butRunEstill returnsnil, so the process exits successfully.This can make container runtimes, scripts, CI jobs, or supervisors treat a failed agent startup as healthy.
Code path
In
cmd/trust-tunnel-agent/app/cmd.go:runServerreturnsserver.Start(opt), andserver.Startreturns errors fromListenAndServe,ListenAndServeTLS, or TLS/config setup. Those errors should propagate back to Cobra instead of being ignored.Expected behavior
If the agent cannot start, the command should return a non-nil error and exit with a non-zero status.
For example:
Impact
Startup failures such as an invalid listen address, port already in use, or TLS file/config errors can be reported as successful process exits. This is especially problematic when the agent is launched by Kubernetes, Docker, systemd, or automation scripts that rely on exit status.
Environment
maincmd/trust-tunnel-agent/app/cmd.go