{"record":{"id":"b234b23b1659cb7c","repo":"XTLS/Xray-core","slug":"empty-shortids","errorCode":null,"errorMessage":"empty \"shortIds\"","messagePattern":"empty \"shortIds\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"infra/conf/transport_security.go","lineNumber":136,"sourceCode":"\t\t\tconfig.MinClientVer = []byte{26, 3, 27} // change it at your own risk: https://github.com/XTLS/Xray-core/commit/af7eb68028732a8ee3c0e5d6ab2b8a657bb2e770\n\t\t\terrors.LogWarning(context.Background(), `REALITY: The default minimal client version is Xray-core v26.3.27, other clients may be refused to connect`)\n\t\t}\n\t\tif c.MaxClientVer != \"\" {\n\t\t\tconfig.MaxClientVer = make([]byte, 3)\n\t\t\tvar u uint64\n\t\t\tfor i, s := range strings.Split(c.MaxClientVer, \".\") {\n\t\t\t\tif i == 3 {\n\t\t\t\t\treturn nil, errors.New(`invalid \"maxClientVer\": `, c.MaxClientVer)\n\t\t\t\t}\n\t\t\t\tif u, err = strconv.ParseUint(s, 10, 8); err != nil {\n\t\t\t\t\treturn nil, errors.New(`\"maxClientVer[`, i, `]\" should be less than 256`)\n\t\t\t\t} else {\n\t\t\t\t\tconfig.MaxClientVer[i] = byte(u)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif len(c.ShortIds) == 0 {\n\t\t\treturn nil, errors.New(`empty \"shortIds\"`)\n\t\t}\n\t\tconfig.ShortIds = make([][]byte, len(c.ShortIds))\n\t\tfor i, s := range c.ShortIds {\n\t\t\tif len(s) > 16 {\n\t\t\t\treturn nil, errors.New(`too long \"shortIds[`, i, `]\": `, s)\n\t\t\t}\n\t\t\tconfig.ShortIds[i] = make([]byte, 8)\n\t\t\tif _, err = hex.Decode(config.ShortIds[i], []byte(s)); err != nil {\n\t\t\t\treturn nil, errors.New(`invalid \"shortIds[`, i, `]\": `, s)\n\t\t\t}\n\t\t}\n\t\tconfig.Dest = s\n\t\tconfig.Type = c.Type\n\t\tconfig.Xver = c.Xver\n\t\tconfig.ServerNames = c.ServerNames\n\t\tconfig.MaxTimeDiff = c.MaxTimeDiff\n\n\t\tif c.Mldsa65Seed != \"\" {","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/infra/conf/transport_security.go#L118-L154","documentation":"Thrown by the REALITY builder when the shortIds array is missing or empty. Short IDs are the per-client authorization tokens REALITY checks during the handshake; with none configured every client would be rejected, so the builder treats it as a config error.","triggerScenarios":"Omitting shortIds from server-side realitySettings or providing \"shortIds\": [].","commonSituations":"First REALITY server setup following a guide that skips shortIds, or a client config mistakenly deployed server-side (clients also carry shortId but the empty array still fails).","solutions":["Add at least one shortId, e.g. \"shortIds\": [\"\"] (empty string allows clients without shortId) or a hex string like \"0123456789abcdef\".","Ensure the client's shortId matches one of the server's entries."],"exampleFix":"// before\n\"realitySettings\": { \"target\": \"www.microsoft.com:443\", \"serverNames\": [\"www.microsoft.com\"], \"privateKey\": \"...\" }\n// after\n\"realitySettings\": { \"target\": \"www.microsoft.com:443\", \"serverNames\": [\"www.microsoft.com\"], \"privateKey\": \"...\", \"shortIds\": [\"\", \"0123456789abcdef\"] }","handlingStrategy":"validation","validationCode":"if len(reality.ShortIds) == 0 {\n    return errors.New(\"reality requires a non-empty shortIds array\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Include shortIds in every REALITY server template (\"\" alone is valid).","Cross-check that client shortIds exist in the server list."],"tags":["config","reality","shortid","validation","go"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}