QuantumNous/new-api · critical
implement me
Error message
implement me
What it means
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.
Source
Thrown at relay/channel/zhipu/adaptor.go:28
relaycommon "github.com/QuantumNous/new-api/relay/common"
"github.com/QuantumNous/new-api/relaykit/dto"
"github.com/QuantumNous/new-api/relaykit/types"
"github.com/samber/lo"
"github.com/gin-gonic/gin"
)
type Adaptor struct {
}
func (a *Adaptor) ConvertGeminiRequest(*gin.Context, *relaycommon.RelayInfo, *dto.GeminiChatRequest) (any, error) {
//TODO implement me
return nil, errors.New("not implemented")
}
func (a *Adaptor) ConvertClaudeRequest(*gin.Context, *relaycommon.RelayInfo, *dto.ClaudeRequest) (any, error) {
//TODO implement me
panic("implement me")
}
func (a *Adaptor) ConvertAudioRequest(c *gin.Context, info *relaycommon.RelayInfo, request dto.AudioRequest) (io.Reader, error) {
//TODO implement me
return nil, errors.New("not implemented")
}
func (a *Adaptor) ConvertImageRequest(c *gin.Context, info *relaycommon.RelayInfo, request dto.ImageRequest) (any, error) {
//TODO implement me
return nil, errors.New("not implemented")
}
func (a *Adaptor) Init(info *relaycommon.RelayInfo) {
}
func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
method := "invoke"
if info.IsStream {View on GitHub (pinned to e2c7aa7b10)
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.
Example fix
// before
func (a *Adaptor) ConvertClaudeRequest(*gin.Context, *relaycommon.RelayInfo, *dto.ClaudeRequest) (any, error) {
//TODO implement me
panic("implement me")
}
// after
func (a *Adaptor) ConvertClaudeRequest(*gin.Context, *relaycommon.RelayInfo, *dto.ClaudeRequest) (any, error) {
return nil, errors.New("claude format is not supported by the zhipu channel")
} Defensive patterns
Strategy: fallback
Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of QuantumNous/new-api@e2c7aa7b10 (2026-08-15).
Data as JSON: /api/errors/0870eb04da7be3e6.
Report an issue: GitHub.