[Bug]: artifact cache upload missing return after storage.Write error (double response + useCache)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
Research direction
Start in pkg/artifactcache/handler.go at the upload/Write path and reproduce the failure by making the cache root unusable, then PATCH with Content-Range and a body. Ensure the storage.Write error response ends the handler before useCache or the success response. Add a regression test that verifies one 500 response and no success-side effects.
Written by the indexing model from the issue text.
Description
Describe the bug
In the artifact cache upload handler, when storage.Write fails the code responds with 500 but does not return, then continues as if the upload succeeded:
if err := h.storage.Write(cache.ID, start, r.Body); err != nil {
h.responseJSON(w, r, 500, err)
}
h.useCache(id)
h.responseJSON(w, r, 200)
On Write failure this:
- Emits a 500 JSON error body
- Still calls
h.useCache(id)(DB touch as if success) - Calls
responseJSON(200)again →http: superfluous response.WriteHeaderand a second body fragment
Every other error branch in this handler returns after responseJSON.
Debug information
- Checkout @
4f411281417e88660bea1c1a1749aa71ae0bd60f - File:
pkg/artifactcache/handler.go(upload / Write path)
Repro steps
Force storage.Write to fail (e.g. cache root is not a usable directory), then PATCH the cache upload endpoint with Content-Range + body.
Observed pattern:
- status 500
- response body like
{"error":"..."}{} - log:
superfluous response.WriteHeaderfromresponseJSON
Expected behavior
On Write error: respond once with 500 and return; do not call useCache or emit 200.
Actual behavior
Double response + useCache after failure.
Suggested direction
if err := h.storage.Write(cache.ID, start, r.Body); err != nil {
h.responseJSON(w, r, 500, err)
return
}
I'd be happy to open a PR with a regression test.
- Dominant language
- Go
- Stars
- 72.1k
- Forks
- 2k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nektos/act
-
runner.arch returns lowercase 'arm64' instead of 'ARM64' when using -self-hosted on ARM64 hosts Openkind/bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100