{"record":{"id":"0971cf3dc1a5f37f","repo":"goharbor/harbor","slug":"expected-s-but-got-s","errorCode":null,"errorMessage":"expected '%s' but got '%s'","messagePattern":"expected '(.+?)' but got '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"src/jobservice/job/impl/sample/job.go","lineNumber":56,"sourceCode":"}\n\n// ShouldRetry ...\nfunc (j *Job) ShouldRetry() bool {\n\treturn true\n}\n\n// Validate is implementation of same method in Interface.\nfunc (j *Job) Validate(params job.Parameters) error {\n\tif len(params) == 0 {\n\t\treturn errors.New(\"parameters required for replication job\")\n\t}\n\tname, ok := params[\"image\"]\n\tif !ok {\n\t\treturn errors.New(\"missing parameter 'image'\")\n\t}\n\n\tif !strings.HasPrefix(name.(string), \"demo\") {\n\t\treturn fmt.Errorf(\"expected '%s' but got '%s'\", \"demo *\", name)\n\t}\n\n\treturn nil\n}\n\n// Run the replication logic here.\nfunc (j *Job) Run(ctx job.Context, params job.Parameters) error {\n\tlogger := ctx.GetLogger()\n\n\tlogger.Info(\"Sample job starting\")\n\tdefer func() {\n\t\tlogger.Info(\"Sample job exit\")\n\t}()\n\n\tlogger.Infof(\"Params: %#v\\n\", params)\n\tif v, ok := ctx.Get(\"sample\"); ok {\n\t\tfmt.Printf(\"Get prop form context: sample=%s\\n\", v)\n\t}","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/jobservice/job/impl/sample/job.go#L38-L74","documentation":"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.","triggerScenarios":"Thrown at src/jobservice/job/impl/sample/job.go:56 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","contentChangedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}