ProxyClient panics on a nil HTTPClient instead of defaulting #959

Closed
opened 2026-08-18 15:58:34 +00:00 by coilyco-ops · 0 comments
Member

community.ProxyClient is an exported struct with exported fields, so a caller can construct one directly. Leaving HTTPClient unset panics on the first turn rather than falling back to a default client.

panic: runtime error: invalid memory address or nil pointer dereference
net/http.(*Client).do(0x0, ...)
community.ProxyClient.completeOnce(...)
	internal/community/proxy.go:1084

Found while wiring cmd/sirens-echo-bridge against the proxy. The runtime itself never hits this, because NewAgent always supplies an instrumented client through sessionHTTPClient, so the gap is only reachable by a second caller. The bridge now sets its own client, which is the right thing for it to do anyway since it wants the otelhttp transport.

Worth a guard regardless. Every other field on the struct treats zero as "take the packaged default", and this one field treating zero as a segfault is the surprise. One line at the top of completeOnce, or a small accessor alongside the existing c.now(), would make the zero value behave like the rest of the struct.

Filed rather than fixed because proxy.go sits next to the reliability work in flight and this is not urgent: no shipped path reaches it.

`community.ProxyClient` is an exported struct with exported fields, so a caller can construct one directly. Leaving `HTTPClient` unset **panics on the first turn** rather than falling back to a default client. ``` panic: runtime error: invalid memory address or nil pointer dereference net/http.(*Client).do(0x0, ...) community.ProxyClient.completeOnce(...) internal/community/proxy.go:1084 ``` Found while wiring `cmd/sirens-echo-bridge` against the proxy. The runtime itself never hits this, because `NewAgent` always supplies an instrumented client through `sessionHTTPClient`, so the gap is only reachable by a second caller. The bridge now sets its own client, which is the right thing for it to do anyway since it wants the otelhttp transport. Worth a guard regardless. Every other field on the struct treats zero as "take the packaged default", and this one field treating zero as a segfault is the surprise. One line at the top of `completeOnce`, or a small accessor alongside the existing `c.now()`, would make the zero value behave like the rest of the struct. Filed rather than fixed because `proxy.go` sits next to the reliability work in flight and this is not urgent: no shipped path reaches it.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
coilyco-gaming/sirens-echo#959
No description provided.