{"record":{"id":"97f49f2a730f2fea","repo":"micro/go-micro","slug":"unsupported-content-type-s","errorCode":null,"errorMessage":"unsupported Content-Type: %s","messagePattern":"unsupported Content-Type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/grpc/grpc.go","lineNumber":362,"sourceCode":"\t\treturn DefaultMaxSendMsgSize\n\t}\n\treturn v.(int)\n}\n\nfunc (g *grpcClient) newGRPCCodec(contentType string) (encoding.Codec, error) {\n\tcodecs := make(map[string]encoding.Codec)\n\tif g.opts.Context != nil {\n\t\tif v := g.opts.Context.Value(codecsKey{}); v != nil {\n\t\t\tcodecs = v.(map[string]encoding.Codec)\n\t\t}\n\t}\n\tif c, ok := codecs[contentType]; ok {\n\t\treturn wrapCodec{c}, nil\n\t}\n\tif c, ok := defaultGRPCCodecs[contentType]; ok {\n\t\treturn wrapCodec{c}, nil\n\t}\n\treturn nil, fmt.Errorf(\"unsupported Content-Type: %s\", contentType)\n}\n\nfunc (g *grpcClient) Init(opts ...client.Option) error {\n\tsize := g.opts.PoolSize\n\tttl := g.opts.PoolTTL\n\n\tfor _, o := range opts {\n\t\to(&g.opts)\n\t}\n\n\t// update pool configuration if the options changed\n\tif size != g.opts.PoolSize || ttl != g.opts.PoolTTL {\n\t\tg.pool.Lock()\n\t\tg.pool.size = g.opts.PoolSize\n\t\tg.pool.ttl = int64(g.opts.PoolTTL.Seconds())\n\t\tg.pool.Unlock()\n\t}\n","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/client/grpc/grpc.go#L344-L380","documentation":"Error \"unsupported Content-Type: %s\" thrown in micro/go-micro.","triggerScenarios":"Setting client.ContentType or service Content-Type to something like application/grpc+msgpack, text/plain, or a typo such as application/grpc+protobuff while using the gRPC client.","commonSituations":"Copy-pasted Content-Type strings with typos; switching clients from mucp (json) to grpc without updating the content type; using a codec name supported elsewhere but not compiled into the gRPC codec map.","solutions":["Use a supported Content-Type: application/grpc+proto, application/grpc+json, or application/grpc+bytes","Register a custom codec via codec registration before making calls if you need a custom format","Fix typos in the configured Content-Type option","Omit the Content-Type option to use the default application/grpc+proto"],"exampleFix":"// before\nclient.ContentType(\"application/grpc+msgpack\")\n// after\nclient.ContentType(\"application/grpc+json\")","handlingStrategy":"validation","validationCode":"var defaultGRPCContentTypes = []string{\n    \"application/grpc\", \"application/grpc+proto\", \"application/grpc+json\", \"application/grpc+bytes\",\n}\nfunc contentTypeSupported(ct string) bool {\n    return slices.Contains(defaultGRPCContentTypes, ct)\n}","typeGuard":null,"tryCatchPattern":"err := client.Call(ctx, req, resp)\nif err != nil && strings.Contains(err.Error(), \"unsupported Content-Type\") {\n    // fix client.ContentType option at startup\n}","preventionTips":["Centralize Content-Type strings as constants, never inline literals","Validate the ContentType option at service startup","Consult the gRPC codec map before adding a custom type","Register custom codecs before any call is made"],"tags":["grpc","codec","content-type","configuration"],"backgroundTag":"unsupported-content-type","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}