XTLS/Xray-core · error

build minecraft profile %d: %w

Error message

build minecraft profile %d: %w

What it means

XMC.Build loops over the configured profiles and calls XMCProfile.Build on each; any per-profile failure is wrapped with the zero-based index %d so you can locate the offending entry. The inner error is one of: invalid username, invalid UUID, or incomplete textures.

Source

Thrown at infra/conf/transport_finalmask.go:784

	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,
	}, nil
}

type Xicmp struct {
	DGRAM bool     `json:"dgram"`
	IPs   []string `json:"ips"`
}

View on GitHub (pinned to 7d214f8b09)

Solutions

  1. Use the index in the message to select profiles[i] (0-based) and read the inner error
  2. Fix that entry per the inner error: username regex, UUID format, or both texture fields
  3. Re-validate the whole list, not just the failing entry

Example fix

// error: build minecraft profile 1: invalid minecraft profile UUID...
// before
"profiles": [ {ok...}, { "username": "Alex", "uuid": "nope" } ]
// after
"profiles": [ {ok...}, { "username": "Alex", "uuid": "e5206dbd-...-c1a1d" } ]
Defensive patterns

Strategy: validation

Validate before calling

func validateXmcProfiles(profiles []XMCProfile) error {
    for i, p := range profiles {
        if !xmcUsernameRe.MatchString(p.Username) { return fmt.Errorf("profile %d: bad username", i) }
        if _, err := uuid.Parse(p.UUID); err != nil { return fmt.Errorf("profile %d: bad uuid", i) }
        if p.TexturesValue == "" || p.TexturesSignature == "" { return fmt.Errorf("profile %d: missing textures", i) }
    }
    return nil
}

Prevention

When it happens

Trigger: An xmc profiles array where element at the reported index has a bad username, unparseable UUID, or missing texturesValue/texturesSignature.

Common situations: Multiple profiles where only one was hastily filled in; index reported is 0-based — developers sometimes edit the wrong (1-based) entry.

Related errors


AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15). Data as JSON: /api/errors/35cd1da78151e83d. Report an issue: GitHub.