theonedev/onedev · error · NotAcceptableException

Unrecognized suggestion action:

Error message

Unrecognized suggestion action: 

What it means

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.

Source

Thrown at server-core/src/main/java/io/onedev/server/web/component/markdown/MarkdownViewer.java:349

			@Override
			protected void respond(AjaxRequestTarget target) {
				IRequestParameters params = RequestCycle.get().getRequest().getPostParameters();
				String suggestionAction = params.getParameterValue(SUGGESTION_ACTION).toString();				
				String suggestionContent = params.getParameterValue(SUGGESTION_CONTENT).toString();
				List<String> suggestion = StringUtils.splitToLines(suggestionContent);
				switch (suggestionAction) {
				case "apply":
					getSuggestionSupport().getApplySupport().applySuggestion(target, suggestion);
					break;
				case "addToBatch":
					getSuggestionSupport().getApplySupport().getBatchSupport().addToBatch(target, suggestion);
					break;
				case "removeFromBatch":
					getSuggestionSupport().getApplySupport().getBatchSupport().removeFromBatch(target);
					break;
				default:
					throw new NotAcceptableException("Unrecognized suggestion action: " + suggestionAction);
				}
			}
			
		});
		
		setOutputMarkupId(true);
	}
	
	@Nullable
	protected SuggestionSupport getSuggestionSupport() {
		return null;
	}
	
	@Override
	public void renderHead(IHeaderResponse response) {
		super.renderHead(response);
		
		response.render(JavaScriptHeaderItem.forReference(new LozadResourceReference()));

View on GitHub (pinned to d44925c47c)

Solutions

  1. Hard-refresh the browser (Ctrl+F5) or clear cache so the bundled suggestion JavaScript matches the server version.
  2. Verify the client code sending the suggestion action uses one of the supported values handled by the switch in MarkdownViewer.
  3. If you customized/patched the markdown editor, update it to the action names defined in the current MarkdownViewer source.
  4. If the error appears after an upgrade, restart the server so recompiled classes are hot-loaded correctly.

Example fix

// before
params.suggestionAction = 'applySuggestion';
// after
params.suggestionAction = 'addToBatch';
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = ['addToBatch', 'removeFromBatch'];
if (!SUPPORTED.includes(action)) { throw new Error('Unsupported suggestion action: ' + action); }

Type guard

function isSuggestionAction(a) { return a === 'addToBatch' || a === 'removeFromBatch'; }

Try / catch

try { sendSuggestionAction(action); } catch (e) { if (e.status === 406) { console.error('Unknown action, refresh client assets', e); } else { throw e; } }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/70582718df7b062b. Report an issue: GitHub.