{"record":{"id":"b222b0def3cb9176","repo":"XTLS/Xray-core","slug":"minecraft-finalmask-w","errorCode":null,"errorMessage":"minecraft finalmask: %w","messagePattern":"minecraft finalmask: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"transport/internet/finalmask/xmc/config.go","lineNumber":14,"sourceCode":"package xmc\n\nimport (\n\t\"fmt\"\n\t\"net\"\n)\n\nfunc (c *Config) TCP() {\n}\n\nfunc (c *Config) WrapConnClient(conn net.Conn) (net.Conn, error) {\n\tprofiles, err := profilesFromConfig(c.Profiles)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"minecraft finalmask: %w\", err)\n\t}\n\tcc, err := newClientConn(conn, profiles, c.Password, c.RsaPublicKey, c.Hostname)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"minecraft finalmask: %w\", err)\n\t}\n\n\treturn cc, nil\n}\n\nfunc (c *Config) WrapConnServer(conn net.Conn) (net.Conn, error) {\n\tprofiles, err := profilesFromConfig(c.Profiles)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"minecraft finalmask: %w\", err)\n\t}\n\tcc, err := wrapConnServer(conn, profiles, c.Password, c.RsaPrivateKey, c.RsaPublicKey)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"minecraft finalmask: %w\", err)\n\t}","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/transport/internet/finalmask/xmc/config.go#L1-L32","documentation":"Config.WrapConnClient failed while parsing Config.Profiles via profilesFromConfig, before any network I/O. The wrapped error is the profile validation failure (nil/empty profile list, empty username, zero/invalid UUID, or duplicate entries depending on profile.go's checks). The connection is never established; this is a local config error.","triggerScenarios":"Calling WrapConnClient with a Config whose Profiles are nil, contain an entry with an empty Username, or carry a malformed UUID; profilesFromConfig returns the error and it is prefixed with 'minecraft finalmask:'.","commonSituations":"JSON/protobuf config where the profiles array was omitted, partially filled, or UUIDs pasted with braces/hyphens in a format the parser rejects; shared templates that forget to override the profiles block.","solutions":["Inspect the wrapped error text — it names the exact profile field that is invalid","Populate Config.Profiles with at least one entry carrying a non-empty Username and a valid UUID","Validate the profile list at startup before enabling the outbound (see validationCode)"],"exampleFix":"// before\ncfg := &xmc.Config{Password: pw, RsaPublicKey: der} // Profiles omitted -> error\n\n// after\ncfg := &xmc.Config{\n    Password:     pw,\n    RsaPublicKey: der,\n    Profiles:     []*xmc.Profile{{Username: \"player1\", Uuid: \"069a79f4-44e9-4726-a5be-fca90e38aaf5\"}},\n}","handlingStrategy":"validation","validationCode":"func validateXmcProfiles(ps []*xmc.Profile) error {\n    if len(ps) == 0 {\n        return errors.New(\"xmc: at least one profile required\")\n    }\n    for i, p := range ps {\n        if p.Username == \"\" {\n            return fmt.Errorf(\"xmc: profile[%d] missing username\", i)\n        }\n        if _, err := uuid.Parse(p.Uuid); err != nil {\n            return fmt.Errorf(\"xmc: profile[%d] bad uuid: %w\", i, err)\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"wrapped, err := cfg.WrapConnClient(conn)\nif err != nil {\n    if strings.HasPrefix(err.Error(), \"minecraft finalmask:\") && !strings.Contains(err.Error(), \"rsa\") {\n        return fmt.Errorf(\"invalid xmc profiles config: %w\", err)\n    }\n    return err\n}","preventionTips":["Validate Profiles at config load, before any dial","Generate UUIDs with a real UUID library to guarantee format","Add config-schema tests that reject empty usernames and malformed UUIDs"],"tags":["config","validation","profiles","go"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}