{"record":{"id":"b8ea597ec77e7d64","repo":"v2rayA/v2rayA","slug":"invalid-parameters","errorCode":null,"errorMessage":"invalid parameters","messagePattern":"invalid parameters","errorType":"exception","errorClass":"ErrInvalidParameter","httpStatus":null,"severity":"error","filePath":"service/kernel/serverObj/serverObj.go","lineNumber":12,"sourceCode":"package serverObj\n\nimport (\n\t\"fmt\"\n\t\"net/url\"\n\n\t\"github.com/v2rayA/v2rayA/conf\"\n\t\"github.com/v2rayA/v2rayA/kernel/coreObj\"\n\t\"github.com/v2rayA/v2rayA/kernel/v2ray/where\"\n)\n\nvar ErrInvalidParameter = fmt.Errorf(\"invalid parameters\")\n\ntype ServerObj interface {\n\tConfiguration(info PriorInfo) (c Configuration, err error)\n\tExportToURL() string\n\tNeedPluginPort() bool\n\tProtoToShow() string\n\tGetProtocol() string\n\tGetHostname() string\n\tGetPort() int\n\tGetName() string\n\tSetName(name string)\n}\n\ntype Configuration struct {\n\tCoreOutbound            coreObj.OutboundObject\n\tExtraOutbounds          []coreObj.OutboundObject\n\tPluginChain             string // The first is a server plugin, and the others are client plugins. Split by \",\".\n\tUDPSupport              bool","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/v2rayA/v2rayA/blob/71e5442fc548c05680ee55eae943e6c0afe9ac51/service/kernel/serverObj/serverObj.go#L1-L30","documentation":"Sentinel error ErrInvalidParameter (service/kernel/serverObj/serverObj.go:12) is returned whenever a proxy server URL or server object cannot be parsed into a valid ServerObj. Parsers for HTTP, SS, SSR, SOCKS, Trojan URLs and NewV2Ray all funnel malformed input into this single error so callers can compare with errors.Is. It signals that the user-supplied link or parameters are structurally invalid (bad URL, non-numeric port, missing required fields).","triggerScenarios":"Calling ParseHttpURL/ParseSSURL/ParseSSRURL/ParseSocksURL/ParseTrojanURL or NewV2Ray with a string whose url.Parse fails (illegal characters, control chars), or whose port cannot be converted by strconv.Atoi (missing, empty, or non-numeric port, e.g. http://example.com/ with no :port and empty t.Port()).","commonSituations":"Pasting a subscription link truncated by a chat client or shell quoting (e.g. missing port after ':'), hand-writing a share URL without a port, URLs containing unencoded special characters like spaces or '#', or copying a subscription body line instead of a share link.","solutions":["Re-check the share URL: ensure the scheme, host, and a numeric port are present (e.g. http://host:8080#name).","Percent-encode special characters (spaces, #, ?) in the URL before passing it in.","If the link came from a subscription, re-fetch the subscription; the entry may be truncated or base64 of the whole body rather than a per-node link.","Inspect the error with errors.Is(err, serverObj.ErrInvalidParameter) to distinguish parse failures from network/other errors and log the offending input."],"exampleFix":"// before\nobj, err := serverObj.ParseHttpURL(\"http://example.com\") // port missing -> ErrInvalidParameter\n// after\nobj, err := serverObj.ParseHttpURL(\"http://example.com:8080#my-proxy\")","handlingStrategy":"validation","validationCode":"u, err := url.Parse(link)\nif err != nil {\n    return fmt.Errorf(\"bad proxy url: %w\", err)\n}\nif _, err := strconv.Atoi(u.Port()); err != nil {\n    return fmt.Errorf(\"proxy url needs a numeric port, got %q\", u.Port())\n}","typeGuard":"func isValidProxyURL(link string) bool {\n    u, err := url.Parse(link)\n    if err != nil || u.Host == \"\" {\n        return false\n    }\n    _, err = strconv.Atoi(u.Port())\n    return err == nil\n}","tryCatchPattern":"if _, err := serverObj.ParseHttpURL(link); err != nil {\n    if errors.Is(err, serverObj.ErrInvalidParameter) {\n        log.Printf(\"skipping malformed node %q\", link)\n        return nil // or substitute a default\n    }\n    return err\n}","preventionTips":["Validate scheme/host/port presence before calling any Parse*URL helper.","Percent-encode user-supplied segments with url.PathEscape / url.QueryEscape.","Never hand-edit base64 sections of share links; re-export them from the source client.","Wrap the sentinel with errors.Is to distinguish this error from others in your import pipeline."],"tags":["go","url-parsing","invalid-input","proxy-config"],"backgroundTag":"invalid-proxy-url","analyzedSha":"71e5442fc548c05680ee55eae943e6c0afe9ac51","analyzedAt":"2026-09-05T20:04:37.459Z","contentChangedAt":"2026-09-05T20:04:37.459Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}