goharbor/harbor · error

expected '%s' but got '%s'

Error message

expected '%s' but got '%s'

What it means

Error "expected '%s' but got '%s'" thrown in goharbor/harbor.

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)

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.