theonedev/onedev · error · NotFoundException

Unable to find resource method (resource: %s, method: %s)

Error message

Unable to find resource method (resource: %s, method: %s)

What it means

MethodDetailPage (REST API help pages) resolves a JAX-RS resource method by name within the resource class via a loadable model. If no public method with the given name exists, it throws NotFoundException with the class and method names.

Source

Thrown at server-core/src/main/java/io/onedev/server/web/page/help/MethodDetailPage.java:71

	private static final String PARAM_RESOURCE = "resource";
	
	private static final String PARAM_METHOD = "method";
	
	private final Class<?> resourceClass;
	
	private final String methodName;
	
	private final IModel<Method> methodModel = new LoadableDetachableModel<Method>() {

		@Override
		protected Method load() {
			for (Method method: resourceClass.getMethods()) {
				if (method.getName().equals(methodName))
					return method;
			}
			String errorMessage = String.format("Unable to find resource method (resource: %s, method: %s)", 
					resourceClass.getName(), methodName);
			throw new NotFoundException(errorMessage);
		}
		
	};
	
	public MethodDetailPage(PageParameters params) {
		super(params);

		var className = params.get(PARAM_RESOURCE).toString();
		try {
			resourceClass = Class.forName(className);
		} catch (ClassNotFoundException e) {
			throw new NotFoundException("Resource class not found: " + className);
		}
		
		methodName = params.get(PARAM_METHOD).toString();
	}

	@Override

View on GitHub (pinned to d44925c47c)

Solutions

  1. Browse the API help index and use the current method name.
  2. Update bookmarks after OneDev upgrades.
  3. Confirm the method exists on the named resource class.

Example fix

// before: /~help/api/UserResource/getOldName
// after: /~help/api/UserResource/getFullName (renamed method)
Defensive patterns

Strategy: try-catch

Validate before calling

// check the method exists on the resource class before deep-linking
var m = Arrays.stream(resourceClass.getMethods())
    .anyMatch(x -> x.getName().equals(methodName));

Try / catch

try {
    openMethodHelp(resource, method);
} catch (NotFoundException e) {
    openApiHelpIndex();
}

Prevention

When it happens

Trigger: Opening a help page /~help/api/<resource>/<method> where <method> is not a method of the resolved resource class.

Common situations: Outdated links after an API method was renamed/removed in a OneDev upgrade; typo in the method name in a hand-written URL.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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