Title: [PR Review] bug(coderd/cachecompress): serveRef continues after falling back when the cache file can't be opened · Issue #32021 · coder/coder · GitHub
Open Graph Title: [PR Review] bug(coderd/cachecompress): serveRef continues after falling back when the cache file can't be opened · Issue #32021 · coder/coder
X Title: [PR Review] bug(coderd/cachecompress): serveRef continues after falling back when the cache file can't be opened · Issue #32021 · coder/coder
Description: In coderd/cachecompress/compress.go, serveRef falls back to the uncompressed file server when it can't open the compressed cache file, but it doesn't return afterwards: cacheFile, err := os.Open(cachePath) if err != nil { c.logger.Error(...
Open Graph Description: In coderd/cachecompress/compress.go, serveRef falls back to the uncompressed file server when it can't open the compressed cache file, but it doesn't return afterwards: cacheFile, err := os.Open(ca...
X Description: In coderd/cachecompress/compress.go, serveRef falls back to the uncompressed file server when it can't open the compressed cache file, but it doesn't return afterwards: cacheFile, err := os...
Opengraph URL: https://github.com/coder/coder/issues/32021
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[PR Review] bug(coderd/cachecompress): serveRef continues after falling back when the cache file can't be opened","articleBody":"In `coderd/cachecompress/compress.go`, `serveRef` falls back to the uncompressed file server when it can't open the compressed cache file, but it doesn't return afterwards:\n\n```go\ncacheFile, err := os.Open(cachePath)\nif err != nil {\n\tc.logger.Error(...)\n\t// fall back to uncompressed\n\thttp.FileServer(c.orig).ServeHTTP(w, r)\n}\ndefer cacheFile.Close()\n```\n\nExecution continues with a nil `*os.File`: `Stat` fails, the compressed headers (`Content-Encoding`, `Vary`) are set on a response that was already sent, and `WriteHeader(200)` is called a second time. The other fallback branches in the same function do return.\n\n**To reproduce:** request a file with `Accept-Encoding: gzip` so it's cached, delete the cached file from the cache dir, then request it again. The server logs `failed to stat compressed cache file ... invalid argument` right after `failed to open compressed cache file`, and Go's HTTP server warns about a superfluous `WriteHeader` call.\n\n**Fix:** add a `return` after the fallback. I've opened a PR with a regression test.\n","author":{"url":"https://github.com/ChenyangLi4288","@type":"Person","name":"ChenyangLi4288"},"datePublished":"2026-11-10T21:57:14Z","url":"https://github.com/coder/coder/issues/32021"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9db70687-38c1-71fc-dbb5-f906abf9bd2a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CB32:192A8C:29E8:34C2:6B042F7E |
| html-safe-nonce | 27c9f72e71e7d1fe740e416492c715ff412a99934f3bf157dc735dabc51f39c2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQjMyOjE5MkE4QzoyOUU4OjM0QzI6NkIwNDJGN0UiLCJ2aXNpdG9yX2lkIjoiODM0MTE0ODQzNzA4MDk3NzI3OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 27835d82071468aa70cef27afdc91b0a26768d5b65bce25a8196201429aa55a1 |
| hovercard-subject-tag | issue:6316681947 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/coder/32021/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5fffb87e84ed46a6fd6055fb22dc0dce38a7e7d835e09bf33cdd260783544d82/coder/coder/issues/32021 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5fffb87e84ed46a6fd6055fb22dc0dce38a7e7d835e09bf33cdd260783544d82/coder/coder/issues/32021 |
| og:image:alt | In coderd/cachecompress/compress.go, serveRef falls back to the uncompressed file server when it can't open the compressed cache file, but it doesn't return afterwards: cacheFile, err := os.Open(ca... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ChenyangLi4288 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/coder git https://github.com/coder/coder.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 440752086 |
| octolytics-dimension-repository_nwo | coder/coder |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 440752086 |
| octolytics-dimension-repository_network_root_nwo | coder/coder |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width