{"record":{"id":"39cf79e507d82941","repo":"apache/beam","slug":"error-cancel-v-w","errorCode":null,"errorMessage":"error Cancel(%+v) = %w","messagePattern":"error Cancel\\(%\\+v\\) = %w","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"sdks/go/pkg/beam/runners/prism/internal/web/web.go","lineNumber":413,"sourceCode":"\t\treturn\n\t}\n\tif err := json.Unmarshal(body, &cancelRequest); err != nil {\n\t\terr = fmt.Errorf(\"error parsing JSON: %s of request: %w\", body, err)\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Forward JobId from POST body avoids direct json Unmarshall on composite types containing protobuf message types.\n\tresp, err := h.Jobcli.Cancel(r.Context(), &jobpb.CancelJobRequest{\n\t\tJobId: cancelRequest.JobID,\n\t})\n\tif err != nil {\n\t\tstatusCode := status.Code(err)\n\t\thttpCode := http.StatusInternalServerError\n\t\tif c, ok := grpcToHttpCodes[statusCode]; ok {\n\t\t\thttpCode = c\n\t\t}\n\t\terr = fmt.Errorf(\"error Cancel(%+v) = %w\", cancelRequest, err)\n\t\thttp.Error(w, err.Error(), httpCode)\n\t}\n\n\tw.Header().Add(kContentType, kApplicationJson)\n\n\tif err = json.NewEncoder(w).Encode(resp); err != nil {\n\t\terr = fmt.Errorf(\"error encoding response: %w\", err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}\n\n// Initialize the web client to talk to the given Job Management Client.\nfunc Initialize(ctx context.Context, port int, jobcli jobpb.JobServiceClient) error {\n\tassetsFs := http.FileServer(http.FS(assets))\n\tmux := http.NewServeMux()\n\n\tmux.Handle(\"/assets/\", assetsFs)\n\tmux.Handle(\"/job/cancel/\", &jobCancelHandler{Jobcli: jobcli})","sourceCodeStart":395,"sourceCodeEnd":431,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/runners/prism/internal/web/web.go#L395-L431","documentation":"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.","triggerScenarios":"Thrown at sdks/go/pkg/beam/runners/prism/internal/web/web.go:413 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the Prism job server logs for the underlying gRPC failure; the job may have already terminated","Verify the job_id being cancelled exists on this server","Retry the cancel after confirming server health"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}