{"record":{"id":"8238f7a4d0587e58","repo":"goharbor/harbor","slug":"not-found-8238f7","errorCode":"NOT_FOUND","errorMessage":"replication execution %d not found","messagePattern":"replication execution (.+?) not found","errorType":"error_code","errorClass":"lib/errors.Error","httpStatus":404,"severity":"error","filePath":"src/controller/replication/execution.go","lineNumber":242,"sourceCode":"\tif value, exist := query.Keywords[\"policy_id\"]; exist {\n\t\tquery.Keywords[\"VendorID\"] = value\n\t\tdelete(query.Keywords, \"policy_id\")\n\t}\n\treturn query\n}\n\nfunc (c *controller) GetExecution(ctx context.Context, id int64) (*Execution, error) {\n\texecs, err := c.execMgr.List(ctx, &q.Query{\n\t\tKeywords: map[string]any{\n\t\t\t\"ID\":         id,\n\t\t\t\"VendorType\": job.ReplicationVendorType,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(execs) == 0 {\n\t\treturn nil, errors.New(nil).WithCode(errors.NotFoundCode).\n\t\t\tWithMessagef(\"replication execution %d not found\", id)\n\t}\n\treturn convertExecution(execs[0]), nil\n}\n\nfunc (c *controller) TaskCount(ctx context.Context, query *q.Query) (int64, error) {\n\tquery = q.MustClone(query)\n\tquery.Keywords[\"VendorType\"] = job.ReplicationVendorType\n\treturn c.taskMgr.Count(ctx, query)\n}\n\nfunc (c *controller) ListTasks(ctx context.Context, query *q.Query) ([]*Task, error) {\n\tquery = q.MustClone(query)\n\tquery.Keywords[\"VendorType\"] = job.ReplicationVendorType\n\ttks, err := c.taskMgr.List(ctx, query)\n\tif err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/controller/replication/execution.go#L224-L260","documentation":"Returned by the replication controller's GetExecution (src/controller/replication/execution.go:242) when listing executions by ID and VendorType=REPLICATION returns zero rows. The vendor-type filter means an execution ID belonging to another job type (e.g. garbage collection, scan) will also report not found. Maps to HTTP 404.","triggerScenarios":"GET /api/v2.0/replication/executions/{id} with an ID that does not exist, belongs to a non-replication vendor type, or was purged; calling controller.GetExecution(ctx, id) after the execution record was cleaned up.","commonSituations":"Stale execution ID held in a dashboard or script; paging through executions while GC deletes old records; passing a task ID where an execution ID was expected; typo'd or truncated ID from logs.","solutions":["Verify the ID by listing executions first: GET /api/v2.0/replication/executions and match the ID","Confirm you queried the right resource type (execution vs task) and the right API (replication vs webhook executions)","Treat 404 as terminal for retry loops - do not keep retrying a deleted execution"],"exampleFix":"// before\nexec, err := replicationCtl.GetExecution(ctx, 999999)\n// 404: replication execution 999999 not found\n\n// after\nexecs, err := apiClient.ListReplicationExecutions(nil)\nif idExists(execs, 999999) {\n    exec, err = apiClient.GetReplicationExecution(999999)\n}","handlingStrategy":"validation","validationCode":"execs, err := apiClient.ListReplicationExecutions(&q.Query{Keywords: map[string]any{\"PolicyID\": policyID}})\nif err != nil { return err }\nfound := false\nfor _, e := range execs {\n    if e.ID == wantID { found = true; break }\n}\nif !found { return fmt.Errorf(\"execution %d not in replication list\", wantID) }","typeGuard":"func isExecutionNotFound(err error) bool {\n    return errors.IsNotFoundErr(err) || errors.IsErr(err, errors.NotFoundCode)\n}","tryCatchPattern":"exec, err := replicationCtl.GetExecution(ctx, id)\nif err != nil {\n    if errors.IsNotFoundErr(err) {\n        // remove from UI cache; do not retry\n    }\n    return err\n}","preventionTips":["Always obtain execution IDs from the list endpoint, never from stale logs","Guard id-driven lookups with an existence check when IDs cross service boundaries","Treat 404 as terminal in retry loops"],"tags":["harbor","replication","execution","not-found","api"],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}