{"record":{"id":"edf8c691cfff2422","repo":"theonedev/onedev","slug":"unrecognized-reference-type","errorCode":null,"errorMessage":"Unrecognized reference type: ","messagePattern":"Unrecognized reference type: ","errorType":"exception","errorClass":"NotAcceptableException","httpStatus":406,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/web/component/markdown/MarkdownViewer.java","lineNumber":324,"sourceCode":"\t\t\t\t\t\ttarget.appendJavaScript(script);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttarget.appendJavaScript(\"onedev.server.markdown.renderCommitTooltip();\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"workspace\":\n\t\t\t\t\tvar workspaceRef = WorkspaceReference.of(referenceId, null);\n\t\t\t\t\tvar workspace = workspaceService.find(workspaceRef.getProject(), workspaceRef.getNumber());\n\t\t\t\t\tif (workspace != null && SecurityUtils.canReadCode(workspace.getProject())) {\n\t\t\t\t\t\tString title = workspace.getUser().getDisplayName() + \" on \" + workspace.getOnDescription() + \" for \" + workspace.getSpecName() + \" (\" + workspace.getStatus().name() + \")\";\n\t\t\t\t\t\tString script = String.format(\"onedev.server.markdown.renderWorkspaceTooltip('%s');\",\n\t\t\t\t\t\t\t\tJavaScriptEscape.escapeJavaScript(title));\n\t\t\t\t\t\ttarget.appendJavaScript(script);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttarget.appendJavaScript(\"onedev.server.markdown.renderWorkspaceTooltip();\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new NotAcceptableException(\"Unrecognized reference type: \" + referenceType);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t});\n\t\t\n\t\tadd(suggestionBehavior = new AbstractPostAjaxBehavior() {\n\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\":","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/web/component/markdown/MarkdownViewer.java#L306-L342","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (in markdown)\nSee [foo:123].\n\n// after\nSee [issue:123].","handlingStrategy":"validation","validationCode":"Set<String> supported = Set.of(\"issue\", \"pullrequest\", \"commit\", \"file\", \"job\", \"build\");\nif (!supported.contains(referenceType))\n    throw new IllegalArgumentException(\"Unsupported reference type: \" + referenceType);","typeGuard":"static boolean isKnownReferenceType(String t) {\n    return t != null && Set.of(\"issue\",\"pullrequest\",\"commit\",\"file\",\"job\",\"build\").contains(t);\n}","tryCatchPattern":"try {\n    viewer.handleReferenceClick(referenceType);\n} catch (NotAcceptableException e) {\n    logger.warn(\"Unknown markdown reference type, ignoring link\");\n}","preventionTips":["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."],"tags":["markdown","reference-link","ajax","unsupported-type"],"backgroundTag":"unsupported-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"}