netbirdio/netbird · warning

id query param required

Error message

id query param required

What it means

HTTP 400 from getObjectKey when the id query parameter is missing or empty on GET /upload-url. The id becomes the first segment of the object key (<id>/<uuid>), so an empty id is rejected before any upload URL is generated.

Source

Thrown at upload-server/server/server.go:72

		defer cancel()
		return s.srv.Shutdown(ctx)
	}
	return nil
}

func configureMux(mux *http.ServeMux) error {
	_, ok := os.LookupEnv(bucketVar)
	if ok {
		return configureS3Handlers(mux)
	} else {
		return configureLocalHandlers(mux)
	}
}

func getObjectKey(w http.ResponseWriter, r *http.Request) string {
	id := r.URL.Query().Get("id")
	if id == "" {
		http.Error(w, "id query param required", http.StatusBadRequest)
		return ""
	}

	return id + "/" + uuid.New().String()
}

func isValidRequest(w http.ResponseWriter, r *http.Request) bool {
	if r.Method != http.MethodGet {
		http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
		return false
	}

	if r.Header.Get(types.ClientHeader) != types.ClientHeaderValue {
		http.Error(w, "unauthorized", http.StatusUnauthorized)
		return false
	}
	return true
}

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Always send a non-empty ?id=<identifier> with GET /upload-url
  2. Validate the id client-side before issuing the request and fail early with a clear message

Example fix

// before
req, _ := http.NewRequest(http.MethodGet, serverURL+"/upload-url", nil)

// after
q := url.Values{}
q.Set("id", bundleID)
req, _ := http.NewRequest(http.MethodGet, serverURL+"/upload-url?"+q.Encode(), nil)
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(id) == "" {
	return fmt.Errorf("upload id required")
}
q := url.Values{"id": []string{id}}
req, err := http.NewRequestWithContext(ctx, http.MethodGet, base+"/upload-url?"+q.Encode(), nil)

Try / catch

A 400 'id query param required' is deterministic: add the missing ?id= and re-issue; retrying unchanged never succeeds.

Prevention

When it happens

Trigger: GET /upload-url with no query string, ?id= (empty value), or a mis-typed parameter name such as ?peerId=...

Common situations: Client templates appending ?id={id} while the peer/bundle id is unset; URL builders that silently drop empty parameters; manual curl tests.

Related errors


AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16). Data as JSON: /api/errors/f30885461f4b7a3d. Report an issue: GitHub.