{"record":{"id":"fbbcbdc3dfb80ebd","repo":"goharbor/harbor","slug":"failed-to-count-running-executions-for-policy-id","errorCode":null,"errorMessage":"failed to count running executions for policy ID: %d: %v","messagePattern":"failed to count running executions for policy ID: (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/controller/replication/execution.go","lineNumber":125,"sourceCode":"\t// create an execution record\n\textra := make(map[string]any)\n\tif op := operator.FromContext(ctx); op != \"\" {\n\t\textra[\"operator\"] = op\n\t}\n\n\tvar count int64\n\t// If running executions are found, skip the current execution and mark it as error.\n\tif policy.SingleActiveReplication {\n\t\tvar err error\n\t\tcount, err = c.execMgr.Count(ctx, &q.Query{\n\t\t\tKeywords: map[string]any{\n\t\t\t\t\"VendorType\": job.ReplicationVendorType,\n\t\t\t\t\"VendorID\":   policy.ID,\n\t\t\t\t\"Status\":     job.RunningStatus.String(),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn 0, fmt.Errorf(\"failed to count running executions for policy ID: %d: %v\", policy.ID, err)\n\t\t}\n\t}\n\n\tid, err := c.execMgr.Create(ctx, job.ReplicationVendorType, policy.ID, trigger, extra)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tif policy.SingleActiveReplication {\n\t\tif count > 0 {\n\t\t\tif err = c.execMgr.MarkError(ctx, id, \"Execution skipped: active replication still in progress.\"); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\treturn id, nil\n\t\t}\n\t}\n\n\t// start the replication flow in background","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/controller/replication/execution.go#L107-L143","documentation":"Error \"failed to count running executions for policy ID: %d: %v\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/controller/replication/execution.go:125 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}