{"record":{"id":"0870eb04da7be3e6","repo":"QuantumNous/new-api","slug":"implement-me-0870eb","errorCode":null,"errorMessage":"implement me","messagePattern":"implement me","errorType":"panic","errorClass":null,"httpStatus":500,"severity":"critical","filePath":"relay/channel/zhipu/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\t\"github.com/samber/lo\"\n\n\t\"github.com/gin-gonic/gin\"\n)\n\ntype Adaptor struct {\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\tmethod := \"invoke\"\n\tif info.IsStream {","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/QuantumNous/new-api/blob/e2c7aa7b102c2075eae2377df3508658d45e88dc/relay/channel/zhipu/adaptor.go#L10-L46","documentation":"Identical stub panic in the zhipu (ZhipuAI/GLM) Adaptor: ConvertClaudeRequest panics with \"implement me\" while the sibling stubs return errors.New(\"not implemented\"). Routing a Claude-format request (/v1/Messages) to a zhipu channel triggers a runtime panic instead of a controlled error response.","triggerScenarios":"Client sends Anthropic-format requests and the model maps to a zhipu channel; channel grouping places zhipu alongside Claude-format-capable providers and load balancing selects it for a /v1/Messages call.","commonSituations":"GLM models exposed under a Claude-compatible endpoint; administrators adding zhipu channels to mixed groups without restricting supported relay formats; relying on model-name prefixes that accidentally route Claude-format traffic to zhipu.","solutions":["Replace the panic with a descriptive error return so the relay yields a 4xx/5xx rather than a crash.","Constrain routing so Claude-format requests only reach channels that implement ConvertClaudeRequest.","Apply the same fix repo-wide: grep for panic(\"implement me\") in relay/channel/*/adaptor.go and convert every occurrence to error returns.","Verify recovery middleware is configured on the relay router so any future stub panic cannot kill the process."],"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 zhipu channel\")\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Convert panic(\"implement me\") to errors.New with a channel-specific message across all adaptors.","Route Claude-format (/v1/Messages) traffic only to channels advertising Claude support; keep zhipu channels out of those groups.","Run a CI grep/AST check that fails the build on panic literals inside relay/channel.","Verify recovery middleware wraps the relay router so even uncaught panics degrade to 500s, not outages."],"tags":["go","relay","zhipu","panic","unimplemented","claude-format"],"backgroundTag":null,"analyzedSha":"e2c7aa7b102c2075eae2377df3508658d45e88dc","analyzedAt":"2026-08-15T10:35:18.111Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}