Skip to content

fix(storage): return already_exists for a duplicate entry - #277

Open
pcmxgti wants to merge 1 commit into
falcondev-oss:devfrom
pcmxgti:fix/dual-keys
Open

pcmxgti wants to merge 1 commit into
falcondev-oss:devfrom
pcmxgti:fix/dual-keys

Conversation

@pcmxgti

@pcmxgti pcmxgti commented Oct 18, 2026

Copy link
Copy Markdown

GitHub rejects a duplicate in-flight reservation with 409 already_exists. The server returned 200 with ok: false, so clients such as BuildKit's gha cache could not tell a duplicate from a failure.

createUpload() now throws AlreadyExistsError, which maps to a 409 response.

Fixes #276

GitHub rejects a duplicate in-flight reservation with 409 already_exists.
The server returned 200 with `ok: false`, so clients such as BuildKit's gha
cache could not tell a duplicate from a failure.

`createUpload()` now throws AlreadyExistsError, which maps to a 409 response.

Fixes falcondev-oss#276
Comment thread lib/storage.ts
.select('id')
.executeTakeFirst()
if (existingUpload) return
if (existingUpload) throw new AlreadyExistsError('upload')

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I could have just checked an empty return, but felt like a brittle check if there are more checks added to createUpload() later on. I took the liberty of creating a new error class.

I can always go back to just checking an empty return if you think that's more aligned with the codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate CreateCacheEntry returns 200 {"ok":false} instead of 409 already_exists, breaking BuildKit type=gha exports (v9.8.0)

1 participant