tailscale/tailscale · error

expected method GET or PUT

Error message

expected method GET or PUT

What it means

Method guard in the peerapi file-put handler (handlePeerPutWithBackend path): the incoming peer request used an HTTP method other than GET or PUT, which are the only methods the inbound Taildrop peerapi endpoint accepts.

Source

Thrown at feature/taildrop/peerapi.go:157

			offset = ranges[0].Start
		}
		n, err := taildropMgr.PutFile(clientID(fmt.Sprint(id)), baseName, r.Body, offset, r.ContentLength)
		switch err {
		case nil:
			d := ext.Clock().Since(t0).Round(time.Second / 10)
			h.Logf("got put of %s in %v from %v/%v", approxSize(n), d, h.RemoteAddr().Addr(), h.Peer().ComputedName)
			io.WriteString(w, "{}\n")
		case ErrNoTaildrop:
			http.Error(w, err.Error(), http.StatusForbidden)
		case ErrInvalidFileName:
			http.Error(w, err.Error(), http.StatusBadRequest)
		case ErrFileExists:
			http.Error(w, err.Error(), http.StatusConflict)
		default:
			http.Error(w, err.Error(), http.StatusInternalServerError)
		}
	default:
		http.Error(w, "expected method GET or PUT", http.StatusMethodNotAllowed)
	}
}

func approxSize(n int64) string {
	if n <= 1<<10 {
		return "<=1KB"
	}
	if n <= 1<<20 {
		return "<=1MB"
	}
	return fmt.Sprintf("~%dMB", n>>20)
}

View on GitHub (pinned to 6e0912f979)

Solutions

  1. Use HTTP GET to download or PUT to upload a taildrop file.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at feature/taildrop/peerapi.go:157 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tailscale/tailscale@6e0912f979 (2026-08-18). Data as JSON: /api/errors/526164c8ecad5d91. Report an issue: GitHub.