You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Schema Registry创建新Schema时Subject Not Found错误(40401)求助

Schema Registry注册Schema后出现"Subject not found"及Schema ID无法查询异常

异常场景

  • 使用AKHQ GUI注册新Schema时,触发「Subject not found」错误(错误码40401),无法理解创建新Schema为何要求Subject已存在。
  • 改用curl命令创建Schema:
    curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" -k --data @key http://my-custom-schemaregistry.org/subjects/MY_TOPIC-value/versions?normalize=false
    
    命令返回Schema ID 123,但调用GET接口 http://my-custom-schemaregistry.org/schemas/ids/123 查询该ID时返回错误:
    {"error_code":40403,"message":"Schema 123 not found"}
    

相关日志

初始操作日志

[2023-05-30 14:11:39,104] INFO 10.237.87.231 - - [30/May/2023:14:11:39 +0000] "GET /subjects/MY_TOPIC-key/versions/latest HTTP/1.1" 404 68 "-" "Java/11.0.17" 2 (io.confluent.rest-utils.requests)
[2023-05-30 14:11:39,109] INFO Registering new schema: subject MY_TOPIC-key, version null, id null, type null, schema size 177 (io.confluent.kafka.schemaregistry.rest.resources.SubjectVersionsResource)
[2023-05-30 14:11:39,118] INFO 10.237.87.231 - - [30/May/2023:14:11:39 +0000] "POST /subjects/MY_TOPIC-key/versions?normalize=false HTTP/1.1" 200 11 "-" "Java/11.0.17" 10 (io.confluent.rest-utils.requests)
[2023-05-30 14:11:39,120] ERROR Request Failed with exception  (io.confluent.rest.exceptions.DebuggableExceptionMapper)
io.confluent.rest.exceptions.RestNotFoundException: Subject 'MY_TOPIC-key' not found.
    at io.confluent.kafka.schemaregistry.rest.exceptions.Errors.subjectNotFoundException(Errors.java:77)
    at io.confluent.kafka.schemaregistry.rest.resources.SubjectVersionsResource.getSchemaByVersion(SubjectVersionsResource.java:141)
    at jdk.internal.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)

后续测试日志

[2023-05-30 21:37:26,752] INFO Registering new schema: subject TEST_TEMP, version null, id null, type null, schema size 756 (io.confluent.kafka.schemaregistry.rest.resources.SubjectVersionsResource)
[2023-05-30 21:37:26,765] INFO 10.237.87.231 - - [30/May/2023:21:37:26 +0000] "POST /subjects/TEST_TEMP/versions?normalize=false HTTP/1.1" 200 11 "-" "Java/11.0.17" 14 (io.confluent.rest-utils.requests)
[2023-05-30 21:37:26,766] ERROR Request Failed with exception  (io.confluent.rest.exceptions.DebuggableExceptionMapper)
io.confluent.rest.exceptions.RestNotFoundException: Subject 'TEST_TEMP' not found.

内容的提问来源于stack exchange,提问作者hudi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 14:13:15