{"record":{"id":"70582718df7b062b","repo":"theonedev/onedev","slug":"unrecognized-suggestion-action","errorCode":null,"errorMessage":"Unrecognized suggestion action: ","messagePattern":"Unrecognized suggestion action: ","errorType":"exception","errorClass":"NotAcceptableException","httpStatus":406,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/web/component/markdown/MarkdownViewer.java","lineNumber":349,"sourceCode":"\n\t\t\t@Override\n\t\t\tprotected void respond(AjaxRequestTarget target) {\n\t\t\t\tIRequestParameters params = RequestCycle.get().getRequest().getPostParameters();\n\t\t\t\tString suggestionAction = params.getParameterValue(SUGGESTION_ACTION).toString();\t\t\t\t\n\t\t\t\tString suggestionContent = params.getParameterValue(SUGGESTION_CONTENT).toString();\n\t\t\t\tList<String> suggestion = StringUtils.splitToLines(suggestionContent);\n\t\t\t\tswitch (suggestionAction) {\n\t\t\t\tcase \"apply\":\n\t\t\t\t\tgetSuggestionSupport().getApplySupport().applySuggestion(target, suggestion);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"addToBatch\":\n\t\t\t\t\tgetSuggestionSupport().getApplySupport().getBatchSupport().addToBatch(target, suggestion);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"removeFromBatch\":\n\t\t\t\t\tgetSuggestionSupport().getApplySupport().getBatchSupport().removeFromBatch(target);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new NotAcceptableException(\"Unrecognized suggestion action: \" + suggestionAction);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t});\n\t\t\n\t\tsetOutputMarkupId(true);\n\t}\n\t\n\t@Nullable\n\tprotected SuggestionSupport getSuggestionSupport() {\n\t\treturn null;\n\t}\n\t\n\t@Override\n\tpublic void renderHead(IHeaderResponse response) {\n\t\tsuper.renderHead(response);\n\t\t\n\t\tresponse.render(JavaScriptHeaderItem.forReference(new LozadResourceReference()));","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/web/component/markdown/MarkdownViewer.java#L331-L367","documentation":"MarkdownViewer's suggestion support handles an AJAX request whose 'action' parameter selects a case in a switch (e.g. addToBatch, removeFromBatch). Any unrecognized action value reaches the default branch and throws a NotAcceptableException. This guards the client->server RPC surface against stale or malformed client code.","triggerScenarios":"An AJAX POST to the suggestion endpoint with a suggestionAction parameter that is not one of the supported case values (e.g. 'addToBatch', 'removeFromBatch'). Typically caused by outdated cached JavaScript, a client plugin/script sending a custom action, or a server/client version mismatch after an upgrade.","commonSituations":"Browser cache serving old markdown/suggestion JS after a OneDev upgrade; a custom script or extension posting its own action names; a proxy or rewrite mangling the action parameter.","solutions":["Hard-refresh the browser (Ctrl+F5) or clear cache so the bundled suggestion JavaScript matches the server version.","Verify the client code sending the suggestion action uses one of the supported values handled by the switch in MarkdownViewer.","If you customized/patched the markdown editor, update it to the action names defined in the current MarkdownViewer source.","If the error appears after an upgrade, restart the server so recompiled classes are hot-loaded correctly."],"exampleFix":"// before\nparams.suggestionAction = 'applySuggestion';\n// after\nparams.suggestionAction = 'addToBatch';","handlingStrategy":"validation","validationCode":"const SUPPORTED = ['addToBatch', 'removeFromBatch'];\nif (!SUPPORTED.includes(action)) { throw new Error('Unsupported suggestion action: ' + action); }","typeGuard":"function isSuggestionAction(a) { return a === 'addToBatch' || a === 'removeFromBatch'; }","tryCatchPattern":"try { sendSuggestionAction(action); } catch (e) { if (e.status === 406) { console.error('Unknown action, refresh client assets', e); } else { throw e; } }","preventionTips":["Cache-bust bundled JS on every server upgrade","Keep client-side action names in sync with the server switch cases","Log unsupported actions client-side before sending"],"tags":["ajax","request-validation","markdown"],"backgroundTag":"invalid-enum-value","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"}