{"record":{"id":"bf5067ac8eb13893","repo":"argoproj/argo-workflows","slug":"method-not-allowed","errorCode":null,"errorMessage":"Method not allowed","messagePattern":"Method not allowed","errorType":"http","errorClass":null,"httpStatus":405,"severity":"warning","filePath":"server/artifacts/artifact_server.go","lineNumber":84,"sourceCode":"func (a *ArtifactServer) GetOutputArtifact(w http.ResponseWriter, r *http.Request) {\n\ta.getArtifact(w, r, false)\n}\n\n//nolint:contextcheck\nfunc (a *ArtifactServer) GetInputArtifact(w http.ResponseWriter, r *http.Request) {\n\ta.getArtifact(w, r, true)\n}\n\n// UploadInputArtifact handles file uploads for workflow input artifacts\n// Path: /upload-artifacts/{namespace}/{workflowTemplateName}/{artifactName}\n// Method: POST\n// Body: multipart/form-data with \"file\" field\n// Response: JSON with artifact location information\n//\n//nolint:contextcheck\nfunc (a *ArtifactServer) UploadInputArtifact(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodPost {\n\t\thttp.Error(w, \"Method not allowed\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\t// Parse path: /upload-artifacts/{namespace}/{workflowTemplateName}/{artifactName}\n\trequestPath := strings.SplitN(r.URL.Path, \"/\", 5)\n\tif len(requestPath) < 5 {\n\t\thttp.Error(w, \"Invalid path. Expected: /upload-artifacts/{namespace}/{workflowTemplateName}/{artifactName}\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tnamespace := requestPath[2]\n\tworkflowTemplateName := requestPath[3]\n\tartifactName := requestPath[4]\n\n\t// Authenticate and authorize\n\tctx, err := a.gateKeeping(r, types.NamespaceHolder(namespace))\n\tif err != nil {\n\t\ta.unauthorizedError(w)\n\t\treturn","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/server/artifacts/artifact_server.go#L66-L102","documentation":"UploadInputArtifact handles multipart artifact uploads at /upload-artifacts/{namespace}/{workflowTemplateName}/{artifactName} and only accepts POST. Any other HTTP verb (GET, PUT, DELETE...) is rejected with 405 \"Method not allowed\" and the handler returns without processing.","triggerScenarios":"Issuing a GET or PUT to the upload-artifacts endpoint instead of a POST multipart/form-data request; curl without -X POST or --upload-file defaults; a proxy/health-checker probing the endpoint with GET.","commonSituations":"Testing the URL in a browser (GET), scripts reusing a generic HTTP helper that defaults to GET, API gateways that rewrite methods.","solutions":["Send the request with method POST: curl -X POST -F \"file=@my-artifact.txt\" <url>","Use curl -F (multipart form) rather than -d, which defaults to POST anyway but ensure verb is POST","Update any client code/health checks to use POST or a different endpoint"],"exampleFix":"# before\ncurl https://argo-server:2746/upload-artifacts/default/my-tmpl/my-artifact\n# after\ncurl -X POST -F \"file=@data.bin\" https://argo-server:2746/upload-artifacts/default/my-tmpl/my-artifact","handlingStrategy":"try-catch","validationCode":"if (method !== 'POST') {\n  throw new Error(`upload-artifacts requires POST, got ${method}`);\n}","typeGuard":null,"tryCatchPattern":"resp, err := http.Post(url, \"\", body)\nif err != nil { return err }\nif resp.StatusCode == http.StatusMethodNotAllowed {\n    return fmt.Errorf(\"endpoint requires POST; check client method\")\n}","preventionTips":["Always send POST with a multipart body to this endpoint","Do not probe upload endpoints with GET health checks","Document the endpoint verb in client SDKs"],"tags":["http","http-405","rest","method-not-allowed"],"backgroundTag":"http-method-not-allowed","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}