{"record":{"id":"c3c5c4d070ca30c0","repo":"apache/beam","slug":"method-not-allowed","errorCode":null,"errorMessage":"Method Not Allowed","messagePattern":"Method Not Allowed","errorType":"http","errorClass":null,"httpStatus":405,"severity":"warning","filePath":"sdks/go/pkg/beam/runners/prism/internal/web/web.go","lineNumber":384,"sourceCode":"\tcodes.Unimplemented:     http.StatusNotImplemented,\n\tcodes.OutOfRange:        http.StatusBadRequest,\n\tcodes.Internal:          http.StatusInternalServerError,\n\tcodes.Unavailable:       http.StatusServiceUnavailable,\n\tcodes.DataLoss:          http.StatusInternalServerError,\n}\n\ntype jobCancelHandler struct {\n\tJobcli jobpb.JobServiceClient\n}\n\ntype cancelJobRequest struct {\n\tJobID string `json:\"job_id\"`\n}\n\nfunc (h *jobCancelHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tvar cancelRequest *cancelJobRequest\n\tif r.Method != http.MethodPost {\n\t\thttp.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\tbody, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"could not read request body: %w\", err)\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tif len(body) == 0 {\n\t\thttp.Error(w, \"empty request body\", http.StatusBadRequest)\n\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","sourceCodeStart":366,"sourceCodeEnd":402,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/runners/prism/internal/web/web.go#L366-L402","documentation":"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.","triggerScenarios":"Sending GET, PUT, DELETE, or any non-POST request to the /jobs/cancel (cancel) HTTP endpoint of the prism web server.","commonSituations":"Hitting the cancel endpoint from a browser address bar (GET), curl without -X POST, or a client library configured with the wrong HTTP verb.","solutions":["Resend the request using the POST method","Include a JSON body such as {\"job_id\":\"<id>\"} when retrying with POST","Check the client code or tool that issued the request and fix the configured method"],"exampleFix":"// before\ncurl http://localhost:8083/jobs/cancel\n// after\ncurl -X POST -H 'Content-Type: application/json' -d '{\"job_id\":\"job-123\"}' http://localhost:8083/jobs/cancel","handlingStrategy":"validation","validationCode":"if req.Method != http.MethodPost { return fmt.Errorf(\"cancel endpoint requires POST, got %s\", req.Method) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always issue POST to mutation endpoints like cancel","Check the endpoint's method contract before integrating"],"tags":["http","method-not-allowed","rest"],"backgroundTag":"http-error-status","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"}