apache/beam · warning

Method Not Allowed

Error message

Method Not Allowed

What it means

This HTTP 405 'Method Not Allowed' response is returned by the prism web UI's job-cancel endpoint when a request arrives with any method other than POST. The handler requires POST because it reads and parses a JSON request body containing the job_id to cancel. It is an intentional guard, not a failure of the library.

Solutions

  1. Resend the request using the POST method
  2. Include a JSON body such as {"job_id":"<id>"} when retrying with POST
  3. Check the client code or tool that issued the request and fix the configured method

Example fix

// before
curl http://localhost:8083/jobs/cancel
// after
curl -X POST -H 'Content-Type: application/json' -d '{"job_id":"job-123"}' http://localhost:8083/jobs/cancel
Defensive patterns

Strategy: validation

Validate before calling

if req.Method != http.MethodPost { return fmt.Errorf("cancel endpoint requires POST, got %s", req.Method) }

Prevention

When it happens

Trigger: Sending GET, PUT, DELETE, or any non-POST request to the /jobs/cancel (cancel) HTTP endpoint of the prism web server.

Common situations: Hitting the cancel endpoint from a browser address bar (GET), curl without -X POST, or a client library configured with the wrong HTTP verb.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/c3c5c4d070ca30c0. Report an issue: GitHub.

Appendix: source

Thrown at sdks/go/pkg/beam/runners/prism/internal/web/web.go:384

	codes.Unimplemented:     http.StatusNotImplemented,
	codes.OutOfRange:        http.StatusBadRequest,
	codes.Internal:          http.StatusInternalServerError,
	codes.Unavailable:       http.StatusServiceUnavailable,
	codes.DataLoss:          http.StatusInternalServerError,
}

type jobCancelHandler struct {
	Jobcli jobpb.JobServiceClient
}

type cancelJobRequest struct {
	JobID string `json:"job_id"`
}

func (h *jobCancelHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	var cancelRequest *cancelJobRequest
	if r.Method != http.MethodPost {
		http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)
		return
	}
	body, err := io.ReadAll(r.Body)
	if err != nil {
		err = fmt.Errorf("could not read request body: %w", err)
		http.Error(w, err.Error(), http.StatusBadRequest)
		return
	}
	if len(body) == 0 {
		http.Error(w, "empty request body", http.StatusBadRequest)
		return
	}
	if err := json.Unmarshal(body, &cancelRequest); err != nil {
		err = fmt.Errorf("error parsing JSON: %s of request: %w", body, err)
		http.Error(w, err.Error(), http.StatusBadRequest)
		return
	}

View on GitHub (pinned to 12126d8942)