apache/beam · error

error Cancel(%+v) =

Error message

error Cancel(%+v) = %w

What it means

Error built in jobCancelHandler.ServeHTTP when the forwarded gRPC Cancel call to the job service fails. The handler maps the gRPC status code to an HTTP code via grpcToHttpCodes (defaulting to 500) and returns the wrapped error to the client; the failing request payload is included for diagnosis.

Solutions

  1. Check the Prism job server logs for the underlying gRPC failure; the job may have already terminated
  2. Verify the job_id being cancelled exists on this server
  3. Retry the cancel after confirming server health
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at sdks/go/pkg/beam/runners/prism/internal/web/web.go:413 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

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

		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
	}

	// Forward JobId from POST body avoids direct json Unmarshall on composite types containing protobuf message types.
	resp, err := h.Jobcli.Cancel(r.Context(), &jobpb.CancelJobRequest{
		JobId: cancelRequest.JobID,
	})
	if err != nil {
		statusCode := status.Code(err)
		httpCode := http.StatusInternalServerError
		if c, ok := grpcToHttpCodes[statusCode]; ok {
			httpCode = c
		}
		err = fmt.Errorf("error Cancel(%+v) = %w", cancelRequest, err)
		http.Error(w, err.Error(), httpCode)
	}

	w.Header().Add(kContentType, kApplicationJson)

	if err = json.NewEncoder(w).Encode(resp); err != nil {
		err = fmt.Errorf("error encoding response: %w", err)
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}
}

// Initialize the web client to talk to the given Job Management Client.
func Initialize(ctx context.Context, port int, jobcli jobpb.JobServiceClient) error {
	assetsFs := http.FileServer(http.FS(assets))
	mux := http.NewServeMux()

	mux.Handle("/assets/", assetsFs)
	mux.Handle("/job/cancel/", &jobCancelHandler{Jobcli: jobcli})

View on GitHub (pinned to 12126d8942)