Skip to content

Retention job fails with "can not get valid member entity" on proxy cache project (Docker Hub) #23608

Description

@zhangxiaopeng-zgci

Update: Corrected root cause (2026-07-24)

After deeper investigation, the retention failure and the can not get valid member entity errors are two separate issues.


Issue 1: Retention failure — missing required parameter nDaysSinceLastPull

Actual error (from jobservice logs)

2026-07-24T05:50:19Z [ERROR] [/pkg/retention/job.go:246]: retention job: missing required parameter nDaysSinceLastPull for rule nDaysSinceLastPull
2026-07-24T05:50:19Z [ERROR] [/jobservice/runner/redis.go:123]: Job RETENTION exit with error: run error: retention job: missing required parameter nDaysSinceLastPull for rule nDaysSinceLastPull

Steps to reproduce

  1. Create a proxy cache project targeting Docker Hub
  2. Create a retention policy with template nDaysSinceLastPull, n_days_since_last_pull: 30
  3. Delete the retention policy and recreate it with identical configuration via API
  4. Trigger retention execution (even dry-run)

Key observations

  • The retention_policy.data JSON in the database is identical to working policies on other projects
  • Only affects the recreated policy — policies that were never deleted work fine
  • The error is missing required parameter nDaysSinceLastPull even though the parameter exists in the DB JSON
  • This suggests a deserialization bug in the jobservice when loading a recreated retention policy

Environment

  • Harbor version: v2.15.2
  • Deployment: HA (2 nodes), external PostgreSQL 15, external Redis 7
  • Project type: Proxy Cache (Docker Hub)

Issue 2: can not get valid member entity errors — external script, NOT a Harbor bug

Root cause

An external script (User-Agent: curl/8.5.0, source IP: HAProxy LB) is sending POST /api/v2.0/projects/{id}/members requests with an empty body to Harbor at 03:00 UTC daily. This causes the can not get valid member entity error with ProjectID:0, UserID:0.

Evidence from Harbor proxy (nginx) access log

10.1.132.41 - POST /api/v2.0/projects/16/members HTTP/1.1 500 66 curl/8.5.0
10.1.132.41 - POST /api/v2.0/projects/17/members HTTP/1.1 500 66 curl/8.5.0
10.1.132.41 - GET /api/v2.0/usergroups HTTP/1.1 200 379 curl/8.5.0

These requests occur at 03:00 UTC — a different time than the retention job (00:00 UTC). The two issues are unrelated.

Reporter: zhangxiaopeng@zgci.ac.cn

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions