goharbor/harbor · error
expected ' ' but got
Error message
expected '%s' but got '%s'
What it means
The replication sample job's Validate step rejected the 'image' parameter because its value does not begin with the required 'demo' prefix; the error echoes the expected prefix pattern ('demo *') against the actual value supplied in job.Parameters.
Solutions
- Set the 'image' job parameter to a repository name starting with 'demo' (e.g. 'demo/hello-world')
- Check the replication rule or API request that created the job for a mistyped image name
- Extend the demo job's Validate logic if a different prefix scheme is required
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/jobservice/job/impl/sample/job.go:56 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16).
Data as JSON: /api/errors/0971cf3dc1a5f37f.
Report an issue: GitHub.
Appendix: source
Thrown at src/jobservice/job/impl/sample/job.go:56
}
// ShouldRetry ...
func (j *Job) ShouldRetry() bool {
return true
}
// Validate is implementation of same method in Interface.
func (j *Job) Validate(params job.Parameters) error {
if len(params) == 0 {
return errors.New("parameters required for replication job")
}
name, ok := params["image"]
if !ok {
return errors.New("missing parameter 'image'")
}
if !strings.HasPrefix(name.(string), "demo") {
return fmt.Errorf("expected '%s' but got '%s'", "demo *", name)
}
return nil
}
// Run the replication logic here.
func (j *Job) Run(ctx job.Context, params job.Parameters) error {
logger := ctx.GetLogger()
logger.Info("Sample job starting")
defer func() {
logger.Info("Sample job exit")
}()
logger.Infof("Params: %#v\n", params)
if v, ok := ctx.Get("sample"); ok {
fmt.Printf("Get prop form context: sample=%s\n", v)
}View on GitHub (pinned to 7b2fd08cc5)