{"record":{"id":"33d46f4d36bf759a","repo":"theonedev/onedev","slug":"method-not-allowed-33d46f","errorCode":null,"errorMessage":"Method not allowed","messagePattern":"Method not allowed","errorType":"http","errorClass":"ClientException","httpStatus":405,"severity":"error","filePath":"server-plugin/server-plugin-pack-helm/src/main/java/io/onedev/server/plugin/pack/helm/HelmPackHandler.java","lineNumber":245,"sourceCode":"                    pack = new Pack();\n                    pack.setProject(project);\n                    pack.setType(HelmPackSupport.TYPE);\n                    pack.setName(chartName);\n                    pack.setVersion(chartVersion);\n                }\n                pack.setData(data);\n                Build build = null;\n                if (buildId != null)\n                    build = buildService.load(buildId);\n                pack.setBuild(build);\n                pack.setUser(SecurityUtils.getUser());\n                pack.setPublishDate(new Date());\n\n                packService.createOrUpdate(pack, List.of(packBlob), true);\n                response.setStatus(SC_CREATED);\n            }));\n        } else {\n            throw new ClientException(SC_METHOD_NOT_ALLOWED, \"Method not allowed\");\n        }\n    }\n\n    @Override\n    public String getApiKey(HttpServletRequest request) {\n        return null;\n    }\n\n\tprivate Project checkProject(Long projectId, boolean needsToWrite) {\n\t\tvar project = projectService.load(projectId);\n\t\tif (!project.isPackManagement()) {\n\t\t\tthrow new ClientException(SC_NOT_ACCEPTABLE, \"Package management not enabled for project '\" + project.getPath() + \"'\");\n\t\t} else if (needsToWrite && !SecurityUtils.canWritePack(project)) {\n\t\t\tthrow new UnauthorizedException(\"No package write permission for project: \" + project.getPath());\n\t\t} else if (!needsToWrite && !SecurityUtils.canReadPack(project)) {\n\t\t\tthrow new UnauthorizedException(\"No package read permission for project: \" + project.getPath());\n\t\t}\n\t\treturn project;","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-pack-helm/src/main/java/io/onedev/server/plugin/pack/helm/HelmPackHandler.java#L227-L263","documentation":"Thrown at the end of HelmPackHandler.handle when the HTTP method is neither POST nor PUT (and not a handled read path), producing 405 Method Not Allowed. The Helm endpoint only supports upload (publish) and the handled GET/read operations; anything else is rejected.","triggerScenarios":"Sending DELETE, PATCH, or other unsupported verbs to the /~helm endpoint URL; misconfigured Helm publish scripts using the wrong HTTP method; health-check bots issuing OPTIONS.","commonSituations":"CI scripts calling the pack endpoint with DELETE to 'remove' a chart version (not supported), reverse-proxies forwarding OPTIONS preflights, or typos where GET was intended but an unexpected method string reaches the handler.","solutions":["Use POST or PUT to publish charts to /~helm; use GET to download","Remove any DELETE/PATCH calls against the Helm pack endpoint — deletion is not supported via this handler","If a preflight/OPTIONS request triggers this, exempt the endpoint from preflight handling or use a client that avoids it","Check the CI script/curl -X flag for the wrong method"],"exampleFix":"// before\ncurl -X DELETE https://server/project/~helm/mychart-1.0.0.tgz\n// after\ncurl -T mychart-1.0.0.tgz https://server/project/~helm","handlingStrategy":"validation","validationCode":"Set<String> allowed = Set.of(\"POST\", \"PUT\", \"GET\", \"HEAD\");\nif (!allowed.contains(httpMethod)) throw new IllegalArgumentException(\"unsupported method for helm pack endpoint: \" + httpMethod);","typeGuard":null,"tryCatchPattern":"try { publishChart(); } catch (ClientException e) { if (e.getMessage().equals(\"Method not allowed\")) switchToPostUpload(); }","preventionTips":["Publish charts only with PUT/POST to /~helm","Do not attempt DELETE against the pack endpoint","Exclude the endpoint from OPTIONS preflight handling"],"tags":["http","helm","method-not-allowed","rest"],"backgroundTag":"unsupported-operation","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}