{"record":{"id":"af85d5c9836c1446","repo":"QuantumNous/new-api","slug":"implement-me","errorCode":null,"errorMessage":"implement me","messagePattern":"implement me","errorType":"panic","errorClass":null,"httpStatus":500,"severity":"critical","filePath":"relay/channel/xunfei/adaptor.go","lineNumber":28,"sourceCode":"\trelaycommon \"github.com/QuantumNous/new-api/relay/common\"\n\t\"github.com/QuantumNous/new-api/relaykit/dto\"\n\t\"github.com/QuantumNous/new-api/relaykit/types\"\n\n\t\"github.com/gin-gonic/gin\"\n)\n\ntype Adaptor struct {\n\trequest *dto.GeneralOpenAIRequest\n}\n\nfunc (a *Adaptor) ConvertGeminiRequest(*gin.Context, *relaycommon.RelayInfo, *dto.GeminiChatRequest) (any, error) {\n\t//TODO implement me\n\treturn nil, errors.New(\"not implemented\")\n}\n\nfunc (a *Adaptor) ConvertClaudeRequest(*gin.Context, *relaycommon.RelayInfo, *dto.ClaudeRequest) (any, error) {\n\t//TODO implement me\n\tpanic(\"implement me\")\n}\n\nfunc (a *Adaptor) ConvertAudioRequest(c *gin.Context, info *relaycommon.RelayInfo, request dto.AudioRequest) (io.Reader, error) {\n\t//TODO implement me\n\treturn nil, errors.New(\"not implemented\")\n}\n\nfunc (a *Adaptor) ConvertImageRequest(c *gin.Context, info *relaycommon.RelayInfo, request dto.ImageRequest) (any, error) {\n\t//TODO implement me\n\treturn nil, errors.New(\"not implemented\")\n}\n\nfunc (a *Adaptor) Init(info *relaycommon.RelayInfo) {\n}\n\nfunc (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {\n\treturn \"\", nil\n}","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/QuantumNous/new-api/blob/e2c7aa7b102c2075eae2377df3508658d45e88dc/relay/channel/xunfei/adaptor.go#L10-L46","documentation":"The xunfei (iFlytek Spark) Adaptor's ConvertClaudeRequest contains a bare panic(\"implement me\") left from an IDE-generated method stub. If a relay request in Claude format is routed to an xunfei channel, this panic crashes the Go process (or is caught by Gin's recovery middleware, aborting the request) instead of returning a clean 'not implemented' error like the sibling methods.","triggerScenarios":"A client calls /v1/Messages (Claude-format endpoint) and the model resolves to a channel of type xunfei; or a Claude-format native request is load-balanced onto an xunfei channel. The relay dispatches to ConvertClaudeRequest and the process panics.","commonSituations":"Mixing Claude-format models into a channel group that contains xunfei channels; model-name routing that unexpectedly matches an xunfei channel; adding xunfei channels to a group that serves /v1/Messages clients.","solutions":["Replace panic with the same error return used by the other stubs: return nil, errors.New(\"not implemented\").","Prevent routing: do not put xunfei channels in groups that will serve Claude-format requests; keep model lists disjoint.","Upgrade once the adaptor implements Claude conversion or the relay returns 400 for unsupported format/channel pairs before dispatch.","Ensure Gin recovery middleware is active so a residual panic cannot take down the whole gateway."],"exampleFix":"// before\nfunc (a *Adaptor) ConvertClaudeRequest(*gin.Context, *relaycommon.RelayInfo, *dto.ClaudeRequest) (any, error) {\n\t//TODO implement me\n\tpanic(\"implement me\")\n}\n// after\nfunc (a *Adaptor) ConvertClaudeRequest(*gin.Context, *relaycommon.RelayInfo, *dto.ClaudeRequest) (any, error) {\n\treturn nil, errors.New(\"claude format is not supported by the xunfei channel\")\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Grep relay/channel/*/adaptor.go for panic( and replace every stub panic with error returns before release.","Enforce format/channel compatibility at routing time: reject Claude-format requests aimed at channels that do not implement ConvertClaudeRequest.","Keep Gin recovery middleware on all relay routes so a stray panic cannot kill the gateway.","Add a compile-time or test-time checklist that every Adaptor interface method returns (nil, err) rather than panicking."],"tags":["go","relay","xunfei","panic","unimplemented","claude-format"],"backgroundTag":null,"analyzedSha":"e2c7aa7b102c2075eae2377df3508658d45e88dc","analyzedAt":"2026-08-15T10:35:18.111Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}