theonedev/onedev · error · UnauthorizedException
No package read permission for project: ${projectPath}
Error message
No package read permission for project: ${projectPath} What it means
checkProject throws UnauthorizedException when a read operation is requested but the current user lacks ReadPack permission on the project. pip installs from the OneDev PyPI index fail with this error.
Source
Thrown at server-plugin/server-plugin-pack-pypi/src/main/java/io/onedev/server/plugin/pack/pypi/PypiPackHandler.java:305
return null;
}
private void sendResponse(HttpServletResponse response, String content) {
try {
response.getOutputStream().print(content);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
private Project checkProject(Long projectId, boolean needsToWrite) {
var project = projectService.load(projectId);
if (!project.isPackManagement()) {
throw new ClientException(SC_NOT_ACCEPTABLE, "Package management not enabled for project '" + project.getPath() + "'");
} else if (needsToWrite && !SecurityUtils.canWritePack(project)) {
throw new UnauthorizedException("No package write permission for project: " + project.getPath());
} else if (!needsToWrite && !SecurityUtils.canReadPack(project)) {
throw new UnauthorizedException("No package read permission for project: " + project.getPath());
}
return project;
}
@Override
public List<String> normalize(List<String> pathSegments) {
return pathSegments;
}
}
View on GitHub (pinned to d44925c47c)
Solutions
- Grant the user 'Read Pack' permission on the project
- Include valid OneDev credentials in pip config (index-url with user:password or keyring)
- If the package should be public, enable anonymous pack read for unauthenticated projects
Example fix
null
Defensive patterns
Strategy: validation
Validate before calling
var project = projectService.load(projectId);
if (!SecurityUtils.canReadPack(project)) throw new IllegalStateException('Missing pack read permission on ' + project.getPath()); Try / catch
try { pipInstall(); } catch (UnauthorizedException e) { configureCredentialsOrRequestAccess(); } Prevention
- Configure pip credentials (index-url with user:token or keyring) for private packages
- Verify cross-project read access for CI jobs in other projects
- Enable anonymous read only when the package is meant to be public
When it happens
Trigger: Any needsToWrite=false endpoint (pip install from the project's ~pypi/simple index, package listing) by a user failing SecurityUtils.canReadPack.
Common situations: Anonymous or low-privilege user installing a private package; CI job in another project without cross-project pack read access; credentials not passed to pip.
Understand the failure class
Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.
Related errors
- No package write permission for project: ${projectPath}
- Access denied
- Issue schedule permission required to set own estimated time
- Issue schedule permission required to set iterations
- No permission to access issue: ${referenceString}
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/f4d0b9db1fe2b699.
Report an issue: GitHub.