goharbor/harbor · error · badRequestError

10013

10013

Error message

parameters required for replication job

What it means

Harbor's sample/demo job (src/jobservice/job/impl/sample/job.go:48) illustrates the job.Interface contract: Validate rejects an empty params map (len(params) == 0, note: nil and {} both count) at submission time with code 10013. It then requires an 'image' key whose string value starts with 'demo'.

Source

Thrown at src/jobservice/job/impl/sample/job.go:48

// MaxFails is implementation of same method in Interface.
func (j *Job) MaxFails() uint {
	return 3
}

// MaxCurrency is implementation of same method in Interface.
func (j *Job) MaxCurrency() uint {
	return 1
}

// 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")

View on GitHub (pinned to 7b2fd08cc5)

Solutions

  1. Pass at least {"image": "demo/..."} — the value must start with 'demo' or the next validation fails
  2. Use this sample implementation as the template when writing your own job's Validate

Example fix

// before
params := job.Parameters{}
// after
params := job.Parameters{"image": "demo/alpine"}
Defensive patterns

Strategy: validation

Validate before calling

if len(params) == 0 {
    return fmt.Errorf("sample job requires params")
}

Prevention

When it happens

Trigger: Submitting the SAMPLE job with no parameters — e.g. POST to the job launch API with name SAMPLE and an absent/empty params object.

Common situations: Integration tests against a dev Harbor; copy-pasting job-launch examples without the params block; smoke-testing the jobservice after deployment.

Related errors


AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16). Data as JSON: /api/errors/21b6575401ff114f. Report an issue: GitHub.