You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Uncontrolled Panics in API Client on Unexpected Server Responses #478
In pkg/connectors/microcks_client.go, functions like GetKeycloakURL and GetTestResult use panic(err) or panic(err.Error()) if response body reading or JSON deserialization fails.
Impact
If a reverse proxy, API gateway, or cloud load balancer returns an HTML error page (e.g., 502 Bad Gateway, 504 Gateway Timeout, 403 Forbidden) instead of valid JSON, the CLI crashes with a Go stack trace instead of presenting a clean error message to the user.
Code Reference
pkg/connectors/microcks_client.go
pkg/connectors/microcks_client.go
Diagram
sequenceDiagram
participant CLI
participant Proxy as Reverse Proxy (Nginx/Cloudflare)
participant Server as Microcks Server
CLI->>Proxy: GET /api/keycloak/config
Proxy--xServer: Connection Refused / Timeout
Proxy-->>CLI: HTTP 504 Gateway Timeout (HTML body)
Note over CLI: io.ReadAll() succeeds but JSON parsing fails
Note over CLI: json.Unmarshal(body, &configResp) errors out
CLI->>CLI: panic(err) (Hard crash with stack trace)
Loading
Steps to Reproduce
Target a server address that serves non-JSON content (e.g., any public landing page returning HTML).
Run microcks login <URL>.
The client fails to unmarshal the HTML body and crashes with panic: invalid character '<' looking for beginning of value.
This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 30 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.
There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. Microcks is a Cloud Native Computing Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.
Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.
This is resolved on current master: all panic() calls were removed from pkg/connectors in #489. Response-body read and JSON decode failures now return classified errors (KindAPI / KindConnection) instead of crashing, and HTTP status codes are validated before parsing — the HTML-error-page-from-a-proxy case is covered by tests like TestGetFullTestResultChecksStatusBeforeParsing. I believe this can be closed.
Activity
github-actions commentedon Jul 30, 2026
This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 30 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.
There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. Microcks is a Cloud Native Computing Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.
Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.
Thank you for your patience ❤️
Caesarsage commentedon Aug 16, 2026
This is resolved on current master: all panic() calls were removed from pkg/connectors in #489. Response-body read and JSON decode failures now return classified errors (KindAPI / KindConnection) instead of crashing, and HTTP status codes are validated before parsing — the HTML-error-page-from-a-proxy case is covered by tests like TestGetFullTestResultChecksStatusBeforeParsing. I believe this can be closed.