--- id: "bug-1675" status: "fixed" status_updated: "2026-09-24" status_note: "" component: "xcecli" severity: "unknown" timestamp: "2026-08-24T13:40:00Z" last_seen: "2026-09-19T09:00:00Z" occurrences: 1 files: ["src/frontend/xcecli/common/request/request.go:97-98", "src/frontend/xcecli/common/request/request.go:185-188"] tags: ["gitea-issue-42", "xcecli", "go", "request.go", "error-message", "ux", "startup-window"] related: [] legacy: true gitea_issue: 42 gitea_synced_status: "fixed" --- # bug-1675: Gitea issue #42 ("刚启动的时候查询作业报的错误不太友好"): `xcecli jobs list` run in the narrow window right after… ## Description Gitea issue #42 ("刚启动的时候查询作业报的错误不太友好"): `xcecli jobs list` run in the narrow window right after the apiserver (re)starts, before its listener is up, prints a raw `get the request failed: [connection refused]` instead of a user-friendly message. Reproduced live on branch scheduler-framework: killed and relaunched the apiserver, hammered `xcecli jobs list` in a tight loop from the instant of relaunch -- attempts 1-13 all returned the exact reported text; the listener came up by attempt 14. ## Environment _Not recorded (migrated from buglog.json)._ ## Reproduction _Not recorded (migrated from buglog.json)._ ## Root cause ExtractErrorMessage() (request.go:185-188) explicitly special-cases the connection-refused case (`if strings.Contains(errStr, "connection refused") { return "connection refused" }`) but returns the raw OS-level string verbatim instead of a friendlier message (e.g. explaining the API server may still be starting up). GetRequestFromAPIServer() (request.go:97-98) then wraps it as `"get the request failed: [%s]"`, producing exactly the reported output. ## Fix FIXED (2026-08-24). src/frontend/xcecli/common/request/request.go:187 -- ExtractErrorMessage()'s connection-refused branch now returns "cannot reach the API server -- it may still be starting up, retry shortly" instead of the raw "connection refused" string. Confirmed no other call site string-matches the old literal. Added TestExtractErrorMessage (request_test.go, table-driven) -- RED before, GREEN after. Full xcecli suite passes. Live-verified: killed+relaunched the apiserver, hit `xcecli jobs list` during the startup window -- new message confirmed both via the fresh test and independently by rebuilding xcecli and re-checking. ## Verification _Not recorded (migrated from buglog.json)._ ## References - Gitea: #42