XTLS/Xray-core · error
marshal minecraft rsa public key: %w
Error message
marshal minecraft rsa public key: %w
What it means
After deriving the RSA key, XMC.Build serializes the public half with x509.MarshalPKIXPublicKey; failure is wrapped here. MarshalPKIXPublicKey on a standard *rsa.PublicKey essentially cannot fail in current Go, so this is a defensive guard around an internal invariant.
Source
Thrown at infra/conf/transport_finalmask.go:777
}
func (c *XMC) Build() (proto.Message, error) {
if len(c.Profiles) == 0 {
return nil, fmt.Errorf("minecraft profiles are required")
}
if c.Password == "" {
return nil, fmt.Errorf("empty password")
}
rsaPrivateKey, err := xmc.DeriveRSAKey(c.Password)
if err != nil {
return nil, fmt.Errorf("derive minecraft rsa key: %w", err)
}
rsaPublicKey, err := x509.MarshalPKIXPublicKey(&rsaPrivateKey.PublicKey)
if err != nil {
return nil, fmt.Errorf("marshal minecraft rsa public key: %w", err)
}
profiles := make([]*xmc.Profile, 0, len(c.Profiles))
for i := range c.Profiles {
profile, err := c.Profiles[i].Build()
if err != nil {
return nil, fmt.Errorf("build minecraft profile %d: %w", i, err)
}
profiles = append(profiles, profile)
}
return &xmc.Config{
Password: c.Password,
Hostname: c.Hostname,
RsaPrivateKey: x509.MarshalPKCS1PrivateKey(rsaPrivateKey),
RsaPublicKey: rsaPublicKey,
Profiles: profiles,
}, nilView on GitHub (pinned to 7d214f8b09)
Solutions
- Treat as an internal failure: retry with a different password to regenerate the key pair
- Update xray-core to the latest patch release in case of a fixed derivation bug
- Report upstream with the wrapped error and xray version
Defensive patterns
Strategy: fallback
Prevention
- Treat as internal invariant failure — retry with a different password
- Stay on patched xray-core releases
- Report upstream if reproducible
When it happens
Trigger: Only reachable if the derived RSA public key is somehow malformed (nil, non-positive modulus) after DeriveRSAKey succeeded — effectively an internal-error path rather than a user-input error.
Common situations: Not encountered in normal operation; would indicate a corrupted derivation result or a Go stdlib regression.
Related errors
- derive minecraft rsa key: %w
- invalid minecraft profile username: %q
- invalid minecraft profile UUID: %w
- incomplete minecraft profile textures
- minecraft profiles are required
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/c54821ad1f59d873.
Report an issue: GitHub.