{"record":{"id":"36bbda1faa594c0f","repo":"XTLS/Xray-core","slug":"please-fill-in-a-valid-value-for-target","errorCode":null,"errorMessage":"please fill in a valid value for \"target\"","messagePattern":"please fill in a valid value for \"target\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"infra/conf/transport_security.go","lineNumber":89,"sourceCode":"\t\t\tswitch s[0] {\n\t\t\tcase '@', '/':\n\t\t\t\tc.Type = \"unix\"\n\t\t\t\tif s[0] == '@' && len(s) > 1 && s[1] == '@' && (runtime.GOOS == \"linux\" || runtime.GOOS == \"android\") {\n\t\t\t\t\tfullAddr := make([]byte, len(syscall.RawSockaddrUnix{}.Path)) // may need padding to work with haproxy\n\t\t\t\t\tcopy(fullAddr, s[1:])\n\t\t\t\t\ts = string(fullAddr)\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tif _, err = strconv.Atoi(s); err == nil {\n\t\t\t\t\ts = \"localhost:\" + s\n\t\t\t\t}\n\t\t\t\tif _, _, err = net.SplitHostPort(s); err == nil {\n\t\t\t\t\tc.Type = \"tcp\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif c.Type == \"\" {\n\t\t\treturn nil, errors.New(`please fill in a valid value for \"target\"`)\n\t\t}\n\t\tif c.Xver > 2 {\n\t\t\treturn nil, errors.New(`invalid PROXY protocol version, \"xver\" only accepts 0, 1, 2`)\n\t\t}\n\t\tif len(c.ServerNames) == 0 {\n\t\t\treturn nil, errors.New(`empty \"serverNames\"`)\n\t\t}\n\t\tif c.PrivateKey == \"\" {\n\t\t\treturn nil, errors.New(`empty \"privateKey\"`)\n\t\t}\n\t\tif config.PrivateKey, err = base64.RawURLEncoding.DecodeString(c.PrivateKey); err != nil || len(config.PrivateKey) != 32 {\n\t\t\treturn nil, errors.New(`invalid \"privateKey\": `, c.PrivateKey)\n\t\t}\n\t\tif c.MinClientVer != \"\" {\n\t\t\tconfig.MinClientVer = make([]byte, 3)\n\t\t\tvar u uint64\n\t\t\tfor i, s := range strings.Split(c.MinClientVer, \".\") {\n\t\t\t\tif i == 3 {","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/infra/conf/transport_security.go#L71-L107","documentation":"Thrown by the REALITY security settings builder when the 'target'/'dest' field cannot be interpreted as a valid destination. The builder normalizes the value: a leading 'https://' gets port 443, a bare number gets 'localhost:' prefixed, and any host:port that survives net.SplitHostPort becomes type tcp; a unix socket path starting with '@' or '/' becomes unix. If after all this c.Type is still empty, the target was unparseable.","triggerScenarios":"Setting realitySettings.target to something like \"example.com\" without a port and not matching any accepted form, an empty string, or malformed values such as \"https://\" alone.","commonSituations":"First-time REALITY setups where target is copied without the port (e.g. \"www.microsoft.com\" instead of \"www.microsoft.com:443\" or \"https://www.microsoft.com\"), or the field name typo'd so it reads as empty.","solutions":["Use the documented forms: \"https://example.com\", \"example.com:443\", \"127.0.0.1:8080\", \"localhost:8080\", or a unix path \"/var/run/x.sock\" / abstract socket \"@x\".","Check the field is spelled exactly \"target\"/\"dest\" in your JSON.","Ensure a port is present when using the raw host:port form."],"exampleFix":"// before\n\"realitySettings\": { \"target\": \"www.microsoft.com\" }\n// after\n\"realitySettings\": { \"target\": \"www.microsoft.com:443\" }","handlingStrategy":"validation","validationCode":"func validRealityTarget(t string) bool {\n    if t == \"\" { return false }\n    if strings.HasPrefix(t, \"@\") || strings.HasPrefix(t, \"/\") { return true }\n    if strings.HasPrefix(t, \"https://\") { return true }\n    if n, err := strconv.Atoi(t); err == nil && n >= 0 { return true }\n    _, _, err := net.SplitHostPort(t)\n    return err == nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include the port in host:port targets, or use the https:// shorthand.","Lint realitySettings for target presence before deploy."],"tags":["config","reality","tls","target","validation","go"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}