theonedev/onedev · error · NotAcceptableException

Cannot {0} issue "{1}" as it has workspaces

Error message

Cannot {0} issue "{1}" as it has workspaces

What it means

DefaultIssueService.delete calls checkNoWorkspaces first: an issue with attached workspaces (running or saved dev environments) cannot be deleted because the workspaces would be orphaned. The formatted message names the operation and issue.

Source

Thrown at server-core/src/main/java/io/onedev/server/service/impl/DefaultIssueService.java:959

			UndefinedFieldResolution resolution = new UndefinedFieldResolution();
			resolution.setFixType(UndefinedFieldResolution.FixType.DELETE_THIS_FIELD);
			resolutions.put(field, resolution);
		}
		return resolutions;
	}

	
	@Transactional
	@Override
	public void delete(Issue issue) {
		checkNoWorkspaces(issue, "delete");
		dao.remove(issue);
		listenerRegistry.post(new IssueDeleted(issue));
	}

	private void checkNoWorkspaces(Issue issue, String operation) {
		if (issue.getWorkspaces().size() > 0) {
			throw new NotAcceptableException(MessageFormat.format(
					"Cannot {0} issue \"{1}\" as it has workspaces",
					operation, issue.getReference().toString(issue.getProject())));
		}
	}
	
	private String getCacheKey(Issue issue) {
		return getCacheKey(issue.getProject().getId(), issue.getNumber());
	}
	
	private String getCacheKey(Long projectId, Long issueNumber) {
		return projectId + ":" + issueNumber;
	}

	@Transactional
	@Listen
	public void on(EntityPersisted event) {
		if (event.getEntity() instanceof Issue) {
			Issue issue = (Issue) event.getEntity();

View on GitHub (pinned to d44925c47c)

Solutions

  1. Delete or detach the workspaces associated with the issue first.
  2. Retry deletion only after issue.getWorkspaces() is empty.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server-core/src/main/java/io/onedev/server/service/impl/DefaultIssueService.java:959 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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