theonedev/onedev · error · NotFoundException
Issue not found: ${referenceString}
Error message
Issue not found: ${referenceString} What it means
getIssue throws NotFoundException when issueService.find returns null — no issue matches the parsed reference (project + number). The reference string is resolved against the current project, so a wrong project or a non-existent issue number yields this error.
Source
Thrown at server-core/src/main/java/io/onedev/server/ai/TodResource.java:469
var summary = IssueHelper.getSummary(projectContext.currentProject, issue);
for (var entry: issue.getFieldInputs().entrySet()) {
summary.put(entry.getKey(), entry.getValue().getValues());
}
summary.put("link", urlService.urlFor(issue, true));
summaries.add(summary);
}
return summaries;
}
private Issue getIssue(Project currentProject, String referenceString) {
var issueReference = IssueReference.of(referenceString, currentProject);
var issue = issueService.find(issueReference.getProject(), issueReference.getNumber());
if (issue != null) {
if (!SecurityUtils.canAccessIssue(issue))
throw new UnauthorizedException("No permission to access issue: " + referenceString);
return issue;
} else {
throw new NotFoundException("Issue not found: " + referenceString);
}
}
@Path("/get-issue")
@GET
public Map<String, Object> getIssueDetail(
@QueryParam("currentProject") @NotNull String currentProjectPath,
@QueryParam("reference") @NotNull String issueReference,
@QueryParam("forWrite") Boolean forWrite) {
var subject = SecurityUtils.getSubject();
if (SecurityUtils.getUser(subject) == null)
throw new UnauthenticatedException();
var currentProject = getProject(currentProjectPath);
var issue = getIssue(currentProject, issueReference);
if (forWrite != null && forWrite &&!SecurityUtils.canWriteCode(issue.getProject()))
throw new UnauthorizedException("No permission to write code in issue project");View on GitHub (pinned to d44925c47c)
Solutions
- Verify the issue exists: check the number in the OneDev UI under the resolved project.
- Pass the correct currentProject so the reference resolves in the intended project, or use a fully-qualified reference like 'projectPath#number'.
- Confirm the issue wasn't deleted or renumbered.
Example fix
// before getIssue(currentProject, "#1234") // wrong project context // after getIssue(currentProject, "my-project#1234") // fully qualified reference
Defensive patterns
Strategy: try-catch
Validate before calling
// validate reference format before calling
function isValidIssueReference(ref) {
return /^(?:[\w.-]+\/)?#?\d+$/.test(ref) || /^[\w.-]+#\d+$/.test(ref);
} Try / catch
try {
return await getIssue(currentProject, ref);
} catch (e) {
if (isNotFoundError(e)) return null; // treat as missing issue
throw e;
} Prevention
- Always use fully-qualified references (projectPath#number) to avoid wrong-project resolution.
- Verify issue numbers exist in the target project before batch processing.
- Handle deleted/renumbered issues by re-listing issues instead of caching numbers.
When it happens
Trigger: Calling issue/sourceIssue/targetIssue with a reference like "#999" or "project#999" where the issue number does not exist in the resolved project, or a malformed/misdirected reference that resolves to the wrong project.
Common situations: Hard-coded issue numbers that were deleted; referencing an issue number from a different project than currentProject; typo in the number or project path.
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
- User not found: ${userName}
- Iteration '${iterationName}' not found
- Not found
- Branch not found: ${branchName}
- Tag not found: ${tagName}
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/3bd8d067e598f1d0.
Report an issue: GitHub.