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());
}
@OverrideView on GitHub (pinned to d44925c47c)
Solutions
- Confirm the workspace still exists under Project > Workspaces and use its current number in the URL.
- Recreate the workspace if it was deleted and you still need it.
- Navigate from the workspace list page instead of a stale URL.
- 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
- Generate workspace links dynamically, never hardcode numbers.
- Handle deleted workspaces gracefully by linking to the list page.
- Validate workspace number parameters before deep-linking.
- Clean up bookmarks after workspace deletion.
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
- Not a changed file:
- Non-existent issue specified in recipient address:
- Non-existent pull request specified in recipient address:
- Unrecognized interpolation variable: ${t}
- Not authorized
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/4fdbc8b4210bb57d.
Report an issue: GitHub.