{"record":{"id":"7b7e229aec1ae7d8","repo":"XTLS/Xray-core","slug":"empty-profiles","errorCode":null,"errorMessage":"empty profiles","messagePattern":"empty profiles","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"transport/internet/finalmask/xmc/client.go","lineNumber":49,"sourceCode":"\thostname        string\n\tpaddingSchedule []paddingTurn\n\tpacket          *packetStream\n\tdeadlines       *connectionDeadlines\n}\n\ntype clientState int\n\nvar (\n\tclientStateHandshake clientState = 1\n\tclientStateProxy     clientState = 2\n)\n\nfunc newClientConn(c net.Conn, profiles []loginProfile, password string, rsaPublicKey []byte, hostname string) (*clientConn, error) {\n\tif len(rsaPublicKey) == 0 {\n\t\treturn nil, fmt.Errorf(\"empty rsa public key\")\n\t}\n\tif len(profiles) == 0 {\n\t\treturn nil, fmt.Errorf(\"empty profiles\")\n\t}\n\tpaddingSchedule, err := newClientPaddingSchedule2612()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"select padding profile: %w\", err)\n\t}\n\treturn &clientConn{\n\t\treader:          bufio.NewReader(c),\n\t\twriter:          c,\n\t\tc:               c,\n\t\tstate:           clientStateHandshake,\n\t\thandshakeLock:   sync.Mutex{},\n\t\tprofiles:        profiles,\n\t\tpassword:        password,\n\t\trsaPublicKey:    rsaPublicKey,\n\t\thostname:        hostname,\n\t\tpaddingSchedule: paddingSchedule,\n\t\tdeadlines:       newConnectionDeadlines(c),\n\t}, nil","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/transport/internet/finalmask/xmc/client.go#L31-L67","documentation":"Thrown by newClientConn when the login profiles list is empty. The XMC client randomly picks one profile (rand.Int over len(profiles)) to send as the Minecraft Login Start username/UUID, so at least one profile must be configured.","triggerScenarios":"Calling newClientConn with a nil or zero-length profiles slice, i.e. an XMC config with no profile entries. Fails immediately at connection construction, before the socket is used.","commonSituations":"Forgetting the profiles array in the outbound config; an empty profiles: [] block; config templating that strips the array when a variable is unset.","solutions":["Add at least one login profile (username/UUID pair) to the client config.","Check the config loader/templating to ensure the profiles array survives rendering.","Validate profiles client-side before dialing (see defense below)."],"exampleFix":"// before\n\"profiles\": []\n// after\n\"profiles\": [{\"username\": \"Steve\", \"uuid\": \"...\"}]","handlingStrategy":"validation","validationCode":"if len(profiles) == 0 {\n\treturn errors.New(\"xmc client requires at least one login profile\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate the profiles array is non-empty before creating the connection.","Watch for templating that renders an empty array when a variable is unset."],"tags":["config","xmc","finalmask","validation"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}