theonedev/onedev · error · NotAcceptableException
Revision and path should be specified
Error message
Revision and path should be specified
What it means
After parsing the URL into revision and file path, RawBlobResource requires both to be non-blank; a raw blob request must identify exactly which revision and which file to fetch. A blank revision or path means the URL is malformed for this endpoint.
Source
Thrown at server-core/src/main/java/io/onedev/server/web/resource/RawBlobResource.java:81
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))
throw new UnauthorizedException();
final Blob blob = project.getBlob(new BlobIdent(revision, path, 0), true);
ResourceResponse response = new ResourceResponse();
response.setAcceptRange(ContentRangeType.BYTES);
response.getHeaders().addHeader("X-Content-Type-Options", "nosniff");
response.setContentType(MimeUtils.sanitize(project.detectMediaType(blob.getIdent()).toString()));
if (blob.getLfsPointer() != null)
response.setContentLength(blob.getLfsPointer().getObjectSize());
else
response.setContentLength(blob.getSize());
if (!ObjectId.isId(revision))
response.disableCaching();View on GitHub (pinned to d44925c47c)
Solutions
- Include both a valid revision (branch, tag, or commit hash) and a file path in the URL.
- Check reverse proxies/rewrites are not stripping trailing URL segments.
- Fix link templates so the file path variable is always populated.
Example fix
// before String url = "/~raw/myproj/main/"; // missing file path // after String url = "/~raw/myproj/main/README.md";
Defensive patterns
Strategy: validation
Validate before calling
if (isBlank(revision) || isBlank(path)) throw new IllegalArgumentException("Revision and file path are required"); Prevention
- Always supply both revision and file path when building raw blob URLs.
- Verify proxies don't strip trailing path segments.
When it happens
Trigger: Raw blob URL missing the revision part or missing the file path, e.g. /~raw/proj/ or /~raw/proj/main/ with no file; empty segments filtered out leaving revisionAndPathSegments with fewer than two entries.
Common situations: Trailing-segment loss after URL rewriting/proxies stripping path parts; template-based link generation with an empty file path variable; root path requests against the raw endpoint.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- revision parameter has to be specified
- Artifact path has to be specified
- Parameter 'attachment-group' has to be specified
- Package name param is missing
- Package version param is missing
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/c403c3b70ea614bc.
Report an issue: GitHub.