Skip to content

ccsr: Fix error code for subject not found#36034

Draft
def- wants to merge 1 commit intoMaterializeInc:mainfrom
def-:pr-ccsr-error-code
Draft

ccsr: Fix error code for subject not found#36034
def- wants to merge 1 commit intoMaterializeInc:mainfrom
def-:pr-ccsr-error-code

Conversation

@def-
Copy link
Copy Markdown
Contributor

@def- def- commented Apr 13, 2026

See https://docs.confluent.io/platform/current/schema-registry/develop/api.html#errors for error codes

Caused by #27641

Nikhil noted this correctly in the original review: #27641 (comment)

@def- def- requested review from a team as code owners April 13, 2026 05:40
@def- def- requested a review from mtabebe April 13, 2026 05:40
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for opening this PR! Here are a few tips to help make the review process smooth for everyone.

PR title guidelines

  • Use imperative mood: "Fix X" not "Fixed X" or "Fixes X"
  • Be specific: "Fix panic in catalog sync when controller restarts" not "Fix bug" or "Update catalog code"
  • Prefix with area if helpful: compute: , storage: , adapter: , sql:

Pre-merge checklist

  • The PR title is descriptive and will make sense in the git log.
  • This PR has adequate test coverage / QA involvement has been duly considered. (trigger-ci for additional test/nightly runs)
  • If this PR includes major user-facing behavior changes, I have pinged the relevant PM to schedule a changelog post.
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • If this PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way), then it is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).

Comment thread src/ccsr/src/client.rs
UnhandledError::Transport(err) => GetSubjectConfigError::Transport(err),
UnhandledError::Api { code, message } => match code {
404 => GetSubjectConfigError::SubjectNotFound,
40401 => GetSubjectConfigError::SubjectNotFound,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are you sure "404" can never happen? In the linked docs I see some APIs that document "404 Not Found" but no sub-error codes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Only if the json body can't be parsed would we return the 404 error code, and would then wrongly consider it as a "SubjectNotFound". All the other error handlers in this file do it the same way.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For example, the GET /config/{subject} API documents these errors:

Status Codes:
 * 404 Not Found – Subject not found
 * 500 Internal Server Error –
      Error code 50001 – Error in the backend datastore

What error code does the API return for "Subject not found", assuming the response can be parsed? It looks like it's 404. Are you suggesting there is a bug in the documentation or am I missing something?

Btw, for PublishError we also match on "409", not a five-digit error code. Is that also a bug?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

From what I can tell their documentation is kind of misleading. The code seems to always set the error code to 40401 for subject not found: https://github.com/confluentinc/schema-registry/blob/master/core/src/main/java/io/confluent/kafka/schemaregistry/rest/exceptions/Errors.java#L25

The 409 is also a bug, fixing.

@def- def- force-pushed the pr-ccsr-error-code branch from 9eebd5d to 8741253 Compare April 14, 2026 10:19
@def- def- requested a review from teskje April 14, 2026 10:19
@def- def- marked this pull request as draft April 14, 2026 10:29
Copy link
Copy Markdown
Contributor

@teskje teskje left a comment

Choose a reason for hiding this comment

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

Thanks!

@def- def- force-pushed the pr-ccsr-error-code branch from 8741253 to 65e5f3b Compare April 14, 2026 14:08
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.

2 participants