theonedev/onedev · error · NotAcceptableException
Unrecognized reference type:
Error message
Unrecognized reference type:
What it means
MarkdownViewer's AjaxRespondListener handles clicks on rendered reference links; when the link's reference type (e.g. issue, pull request, commit, file) is not among the recognized kinds, respond() throws NotAcceptableException with "Unrecognized reference type: " + referenceType. This guards against malformed or newer link types the viewer does not know how to render.
Source
Thrown at server-core/src/main/java/io/onedev/server/web/component/markdown/MarkdownViewer.java:324
target.appendJavaScript(script);
} else {
target.appendJavaScript("onedev.server.markdown.renderCommitTooltip();");
}
break;
case "workspace":
var workspaceRef = WorkspaceReference.of(referenceId, null);
var workspace = workspaceService.find(workspaceRef.getProject(), workspaceRef.getNumber());
if (workspace != null && SecurityUtils.canReadCode(workspace.getProject())) {
String title = workspace.getUser().getDisplayName() + " on " + workspace.getOnDescription() + " for " + workspace.getSpecName() + " (" + workspace.getStatus().name() + ")";
String script = String.format("onedev.server.markdown.renderWorkspaceTooltip('%s');",
JavaScriptEscape.escapeJavaScript(title));
target.appendJavaScript(script);
} else {
target.appendJavaScript("onedev.server.markdown.renderWorkspaceTooltip();");
}
break;
default:
throw new NotAcceptableException("Unrecognized reference type: " + referenceType);
}
}
});
add(suggestionBehavior = new AbstractPostAjaxBehavior() {
@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":View on GitHub (pinned to d44925c47c)
Solutions
- Fix the reference link in the markdown source to use a supported type (issue, pull request, commit, file, etc.).
- If the type comes from a plugin, ensure that plugin is installed and its reference contributor is registered.
- Align client/server versions so documents generated by a newer version are viewed with a compatible viewer.
Example fix
// before (in markdown) See [foo:123]. // after See [issue:123].
Defensive patterns
Strategy: validation
Validate before calling
Set<String> supported = Set.of("issue", "pullrequest", "commit", "file", "job", "build");
if (!supported.contains(referenceType))
throw new IllegalArgumentException("Unsupported reference type: " + referenceType); Type guard
static boolean isKnownReferenceType(String t) {
return t != null && Set.of("issue","pullrequest","commit","file","job","build").contains(t);
} Try / catch
try {
viewer.handleReferenceClick(referenceType);
} catch (NotAcceptableException e) {
logger.warn("Unknown markdown reference type, ignoring link");
} Prevention
- Only generate reference links with types the current OneDev version supports.
- Keep plugins that define custom reference types installed and up to date.
- Fix mistyped reference prefixes in markdown documents.
When it happens
Trigger: Clicking/fetching the AJAX callback for a markdown reference link whose type parameter is unknown (typo, plugin-specific type, or a link produced by a newer OneDev version), or hand-crafted requests to the behavior's callback URL with a bogus type.
Common situations: Markdown containing custom or mistyped reference syntax; upgrading/downgrading OneDev so stored documents contain link types the current viewer cannot handle; bots hitting the callback URL directly.
Related errors
- Unrecognized suggestion action:
- Revision not found:
- Pop state data is missing
- Permission denied
- Permission denied
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/edf8c691cfff2422.
Report an issue: GitHub.