theonedev/onedev · error · EntityNotFoundException

Project not found: ${projectPath}

Error message

Project not found: ${projectPath}

What it means

RawBlobResource serves raw blob content over HTTP. Before serving, it resolves the project by the path encoded in the URL; if no project matches that path, it throws EntityNotFoundException. This means the first indexed URL segment does not correspond to any existing project.

Source

Thrown at server-core/src/main/java/io/onedev/server/web/resource/RawBlobResource.java:65

import io.onedev.server.web.util.MimeUtils;
import io.onedev.server.web.util.WicketUtils;

public class RawBlobResource extends AbstractResource {

	private static final long serialVersionUID = 1L;
	
	private static final String PARAM_DISPOSITION = "disposition";
	
	private static final Logger logger = LoggerFactory.getLogger(RawBlobResource.class);

	@Override
	protected ResourceResponse newResourceResponse(Attributes attributes) {
		PageParameters params = attributes.getParameters();

		String projectPath = params.get(ProjectMapperUtils.PARAM_PROJECT).toString();
		Project project = getProjectService().findByPath(projectPath);
		if (project == null)
			throw new EntityNotFoundException("Project not found: " + projectPath);
		
		List<String> revisionAndPathSegments = new ArrayList<>();
		for (int i = 0; i < params.getIndexedCount(); i++) {
			String segment = params.get(i).toString();
			if (segment.contains(".."))
				throw new ExplicitException("Invalid request path");
			if (segment.length() != 0)
				revisionAndPathSegments.add(segment);
		}

		BlobIdent blobIdent = new BlobIdent(project, revisionAndPathSegments);

		String revision = blobIdent.revision;
		String path = blobIdent.path;
		if (StringUtils.isBlank(revision) || StringUtils.isBlank(path))
			throw new NotAcceptableException("Revision and path should be specified");

		if (!SecurityUtils.canReadCode(project))

View on GitHub (pinned to d44925c47c)

Solutions

  1. Verify the project path segment in the URL matches an existing project (check Administration > Projects or project URL).
  2. Correct typos in the project path portion of the URL.
  3. If the project was renamed, update stored links/scripts to the new path.
  4. If deleted, restore the project or point the URL at another project.

Example fix

// before
curl https://onedev.example.com/~raw/my-proj/refs/heads/main/README.md
// after
curl https://onedev.example.com/~raw/myproject/refs/heads/main/README.md
Defensive patterns

Strategy: validation

Validate before calling

if (!projects.stream().anyMatch(p -> p.getPath().equals(projectPath))) throw new IllegalArgumentException("Unknown project path: " + projectPath);

Try / catch

try { /* raw request */ } catch (HttpClientErrorException | WebApplicationException e) { if (e.getResponse().getStatus() == 404) { /* handle missing project */ } }

Prevention

When it happens

Trigger: GET on the raw blob resource URL whose {projectPath} segment does not match any project path, e.g. typo in project name, project renamed/deleted, or URL crafted with a wrong account/project path.

Common situations: Hotlinks to raw files after a project rename or delete; typos in scripts/cURL commands; cross-server URLs pointing at a different OneDev instance whose projects differ.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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