kitex-knowledge

Provides reference documentation for developing and troubleshooting Kitex RPC microservices in Go.

Updated Apr 30, 2026
One-click install
npx skills add https://github.com/yuezhen-huang/my-bytedance-skillhub --skill kitex-knowledge-yuezhen-huang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kitex-knowledge
Source: https://github.com/yuezhen-huang/my-bytedance-skillhub/tree/main/kitex-knowledge
Command: npx skills add https://github.com/yuezhen-huang/my-bytedance-skillhub --skill kitex-knowledge-yuezhen-huang

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Developers working with the Kitex RPC framework often need authoritative guidance on IDL definition, code generation, service governance configuration, and cryptic RPC error codes (such as 103 timeouts or 1601 ACL rejections) scattered across internal documentation. ## Core Features & Use Cases - IDL & Code Generation: Define Thrift/Protobuf IDL and generate Client/Server code with the kitex tool, including Git-based IDL imports and version pinning. - Service Governance: Configure load balancing, timeouts, retries, connection pools, middleware, and circuit breakers for production RPC services. - Error Code Reference: Look up Kitex/Kite, Mesh Proxy, DES-RPC, and MySQL Mesh error codes with root-cause explanations and remediation steps. - Use Case: When a production RPC call fails with error code 1201 (connection timeout), consult the error code reference to identify the cause and adjust connection timeout or retry policies accordingly. ## Quick Start Ask the agent how to configure retry and timeout policies for a Kitex client calling a downstream service.

Frequently Asked Questions about kitex-knowledge

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate Go code from a Thrift IDL with Kitex?

Run the kitex command with the -module flag for your Go module and the IDL file path, for example kitex -module myproject example.thrift. Add -service with a service name to also generate server scaffolding including main.go and handler.go.

How do I configure timeout and retry for a Kitex client?

Set RPC timeout with client.WithRPCTimeout and connection timeout with client.WithConnectTimeout at client creation. For retries, build a retry.NewFailurePolicy, set WithMaxRetryTimes, and pass it via client.WithFailureRetry; CallOptions can override per request.

What does Kitex error code 103 mean?

Error code 103 is RPCTimeoutCode, meaning the RPC call to the server timed out or the business code canceled the context. Check the error message in call.log to distinguish a genuine timeout from an explicit context cancellation.

Why does Kitex code generation fail with Thrift version errors?

Apache Thrift v0.14.0 introduced incompatible APIs, causing errors like not enough arguments in call to iprot.ReadStructBegin. Pin the dependency with go get github.com/apache/[email protected] or a go.mod replace directive.

Does Kitex support consistent hash load balancing?

Yes, Kitex provides a built-in consistent hash balancer via loadbalance.NewConsistHashBalancer with a hash key function, useful for local cache affinity and session stickiness. Weighted random and weighted round robin are also built in, and custom balancers are supported.

How do I access request and response inside a Kitex middleware?

Use type assertion on the req and resp interface{} parameters inside the middleware endpoint function, for example casting to your generated request type. Server middleware receives business Request/Response types, while client middleware receives Args/Result wrappers.