goharbor/harbor · error

failed to unmashal the param

Error message

failed to unmashal the param: %v

What it means

purgeCallback fails to JSON-unmarshal the serialized JobPolicy parameter stored by the scheduler for the purge-audit-log job. A corrupt or incompatible payload in the scheduler record makes the scheduled purge run fail before starting.

Solutions

  1. Inspect the scheduler job's callback parameter for corrupt or truncated JSON
  2. Reschedule the purge audit log job so a fresh, valid JobPolicy is serialized
  3. Check for schema drift between the version that scheduled the job and the current JobPolicy struct
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/controller/purge/controller.go:47 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/3e4412e3c710cd74. Report an issue: GitHub.

Appendix: source

Thrown at src/controller/purge/controller.go:47

const (
	// SchedulerCallback ...
	SchedulerCallback = "PURGE_AUDIT_LOG_CALLBACK"
)

// Ctrl a global purge controller instance
var Ctrl = NewController()

func init() {
	err := scheduler.RegisterCallbackFunc(SchedulerCallback, purgeCallback)
	if err != nil {
		log.Fatalf("failed to registry purge job call back, %v", err)
	}
}

func purgeCallback(ctx context.Context, p string) error {
	param := &JobPolicy{}
	if err := json.Unmarshal([]byte(p), param); err != nil {
		return fmt.Errorf("failed to unmashal the param: %v", err)
	}
	_, err := Ctrl.Start(ctx, *param, task.ExecutionTriggerSchedule)
	return err
}

// Controller defines the interface with the purge job
type Controller interface {
	// Start kick off a purge schedule
	Start(ctx context.Context, policy JobPolicy, trigger string) (int64, error)
	// Stop a purge job
	Stop(ctx context.Context, id int64) error
}

type controller struct {
	taskMgr task.Manager
	exeMgr  task.ExecutionManager
}

View on GitHub (pinned to 7b2fd08cc5)