{"record":{"id":"3d4b8b7508910895","repo":"MHSanaei/3x-ui","slug":"bad-legacy-ss-port-q-w","errorCode":null,"errorMessage":"bad legacy ss port %q: %w","messagePattern":"bad legacy ss port %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/util/link/outbound.go","lineNumber":403,"sourceCode":"\t// legacy: whole thing b64\n\tdec, err := base64DecodeFlexible(core)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tat = strings.Index(dec, \"@\")\n\tif at < 0 {\n\t\treturn nil, fmt.Errorf(\"bad legacy ss\")\n\t}\n\tuserInfo := dec[:at]\n\thp := dec[at+1:]\n\tcolon := strings.LastIndex(hp, \":\")\n\tif colon < 0 {\n\t\treturn nil, fmt.Errorf(\"bad legacy ss hp\")\n\t}\n\thost := hp[:colon]\n\tport, err := strconv.Atoi(hp[colon+1:])\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"bad legacy ss port %q: %w\", hp[colon+1:], err)\n\t}\n\tmethod, pass := splitMethodPass(userInfo)\n\tidentity := \"ss:\" + method + \":\" + pass + \"@\" + host + \":\" + strconv.Itoa(port)\n\tob := Outbound{\n\t\t\"protocol\": \"shadowsocks\",\n\t\t\"tag\":      remark,\n\t\t\"settings\": map[string]any{\n\t\t\t\"servers\": []any{\n\t\t\t\tmap[string]any{\"address\": host, \"port\": port, \"password\": pass, \"method\": method},\n\t\t\t},\n\t\t},\n\t}\n\treturn &ParseResult{Outbound: ob, Identity: identity}, nil\n}\n\nfunc splitMethodPass(userInfo string) (string, string) {\n\tbefore, after, ok := strings.Cut(userInfo, \":\")\n\tif !ok {","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/MHSanaei/3x-ui/blob/ad32144c42455696ea9f14e12168beac3e25f5d2/internal/util/link/outbound.go#L385-L421","documentation":"Returned by the legacy ss branch when the decoded host:port part has a colon but the text after the last colon fails strconv.Atoi — the port is present yet not a plain integer. The message quotes the bad port text, making the offending segment immediately visible.","triggerScenarios":"Port written as a service name ('ssh') or empty; trailing remark glued on with ':' (method:pass@host:443:remark); IPv6 without brackets making a hex group the 'port'; leftover path text after the port.","commonSituations":"The same hand-edited or provider-quirky legacy links as the other legacy errors; double separators from concatenation scripts; payloads decoded with the wrong base64 variant producing near-miss strings.","solutions":["Read the quoted value in the error message — it is exactly what failed to parse as an integer.","Fix the payload to method:password@host:PORT with a numeric port and re-base64 it.","Move remarks into the fragment (#) instead of a colon suffix.","Bracket IPv6 hosts in the payload."],"exampleFix":"// before (payload: aes-256-gcm:pass@example.com:https)\nss://...\n\n// after (payload: aes-256-gcm:pass@example.com:443)\nss://YWVzLTI1Ni1nY206cGFzc0BleGFtcGxlLmNvbTo0NDM=","handlingStrategy":"validation","validationCode":"func legacySSPortIsNumeric(link string) bool {\n    core := strings.TrimPrefix(link, \"ss://\")\n    dec, err := base64DecodeFlexible(core)\n    if err != nil { return false }\n    i := strings.LastIndex(dec, \":\")\n    if i < 0 { return false }\n    _, err = strconv.Atoi(dec[i+1:])\n    return err == nil\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"bad legacy ss port\") {\n    // message quotes the bad segment: rewrite payload with a numeric port and re-encode\n}","preventionTips":["Use numeric ports only in legacy payloads.","Put remarks in # fragments, never after a colon.","Validate decoded payloads with ^[^@]+@[^@]+:\\d+$."],"tags":["parsing","proxy-links","shadowsocks","legacy","port"],"backgroundTag":null,"analyzedSha":"ad32144c42455696ea9f14e12168beac3e25f5d2","analyzedAt":"2026-08-15T11:13:23.905Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}