theonedev/onedev · error · EntityNotFoundException

Workspace not found

Error message

Workspace not found

What it means

WorkspaceDetailPage's LoadableDetachableModel loads the workspace by project and workspace number. If workspaceService.find returns null (no workspace with that number in this project), it throws EntityNotFoundException with the localized message 'Workspace not found', which renders as an error page instead of showing the detail view.

Source

Thrown at server-core/src/main/java/io/onedev/server/web/page/project/workspaces/detail/WorkspaceDetailPage.java:108

	protected SettingService settingService;

	private Workspace.Status workspaceStatus;

	public WorkspaceDetailPage(PageParameters params) {
		super(params);

		String workspaceNumberString = params.get(PARAM_WOPKSPACE).toString();
		if (StringUtils.isBlank(workspaceNumberString))
			throw new RestartResponseException(ProjectOverviewPage.class, ProjectOverviewPage.paramsOf(getProject().getId()));

		workspaceModel = new LoadableDetachableModel<Workspace>() {

			@Override
			protected Workspace load() {
				Long workspaceNumber = Long.parseLong(workspaceNumberString);
				Workspace workspace = workspaceService.find(getProject(), workspaceNumber);
				if (workspace == null)
					throw new EntityNotFoundException(_T("Workspace not found"));
				if (!workspace.getProject().equals(getProject()))
					throw new RestartResponseException(WorkspaceDefaultPage.class, paramsOf(workspace));
				return workspace;
			}

		};
	}

	public Workspace getWorkspace() {
		return workspaceModel.getObject();
	}

	@Override
	protected boolean isPermitted() {
		return SecurityUtils.canCreateWorkspaces(getProject());
	}

	@Override

View on GitHub (pinned to d44925c47c)

Solutions

  1. Confirm the workspace still exists under Project > Workspaces and use its current number in the URL.
  2. Recreate the workspace if it was deleted and you still need it.
  3. Navigate from the workspace list page instead of a stale URL.
  4. Check the URL's project path matches the project that owns the workspace number.
Defensive patterns

Strategy: fallback

Validate before calling

Workspace ws = workspaceService.find(project, workspaceNumber);
if (ws == null) { /* redirect to workspace list */ }

Try / catch

try {
  page = new WorkspaceDetailPage(params);
} catch (EntityNotFoundException e) {
  setResponsePage(WorkspaceListPage.class);
}

Prevention

When it happens

Trigger: Visiting a WorkspaceDetailPage URL with a workspaceNumberString that does not resolve to a workspace under the current project — e.g. a stale bookmark after the workspace was deleted, or a mistyped/foreign workspace number.

Common situations: Bookmarked or shared workspace links pointing at a deleted workspace; URL copied from another project; number re-parse yielding a different workspace after data migration.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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