{"record":{"id":"0ec394333f049cd4","repo":"tailscale/tailscale","slug":"size-parameter-is-only-supported-with-disco-ping","errorCode":null,"errorMessage":"'size' parameter is only supported with disco pings","messagePattern":"'size' parameter is only supported with disco pings","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"ipn/localapi/localapi.go","lineNumber":1293,"sourceCode":"\tif err != nil {\n\t\thttp.Error(w, \"invalid IP\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tpingTypeStr := r.FormValue(\"type\")\n\tif pingTypeStr == \"\" {\n\t\thttp.Error(w, \"missing 'type' parameter\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tsize := 0\n\tsizeStr := r.FormValue(\"size\")\n\tif sizeStr != \"\" {\n\t\tsize, err = strconv.Atoi(sizeStr)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"invalid 'size' parameter\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tif size != 0 && tailcfg.PingType(pingTypeStr) != tailcfg.PingDisco {\n\t\t\thttp.Error(w, \"'size' parameter is only supported with disco pings\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tif size > magicsock.MaxDiscoPingSize {\n\t\t\thttp.Error(w, fmt.Sprintf(\"maximum value for 'size' is %v\", magicsock.MaxDiscoPingSize), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t}\n\tres, err := h.b.Ping(ctx, ip, tailcfg.PingType(pingTypeStr), size)\n\tif err != nil {\n\t\tWriteErrorJSON(w, err)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(res)\n}\n\nfunc (h *Handler) serveDial(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != httpm.POST {","sourceCodeStart":1275,"sourceCodeEnd":1311,"githubUrl":"https://github.com/tailscale/tailscale/blob/6e0912f97994f927632b34ae9e63b53d6516a6ac/ipn/localapi/localapi.go#L1275-L1311","documentation":"The ping handler got a non-zero 'size' parameter together with a ping 'type' other than disco. Only magicsock disco pings carry a configurable payload size, so a size with TSMP/ICMP/peerapi pings is rejected with 400 rather than silently ignored.","triggerScenarios":"Thrown at ipn/localapi/localapi.go:1293 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set type=disco when using the size parameter","Omit size for other ping types","Check for accidental default size values in the client"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6e0912f97994f927632b34ae9e63b53d6516a6ac","analyzedAt":"2026-08-18T08:17:25.280Z","contentChangedAt":"2026-08-18T08:17:25.280Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}