{"record":{"id":"378e9172ff7cc096","repo":"crowdsecurity/crowdsec","slug":"invalid-on-success-for-s-s","errorCode":null,"errorMessage":"invalid 'on_success' for '%s': %s","messagePattern":"invalid 'on_success' for '(.+?)': (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/csprofiles/csprofiles.go","lineNumber":49,"sourceCode":"\tprofilesRuntime := make([]*Runtime, 0)\n\n\tfor _, profile := range profilesCfg {\n\t\tvar runtimeFilter, runtimeDurationExpr *vm.Program\n\n\t\truntime := &Runtime{}\n\n\t\txlog := logging.SubLogger(log.StandardLogger(), \"profile\", log.InfoLevel)\n\n\t\truntime.Logger = xlog.WithFields(log.Fields{\n\t\t\t\"type\": \"profile\",\n\t\t\t\"name\": profile.Name,\n\t\t})\n\n\t\truntime.RuntimeFilters = make([]*vm.Program, len(profile.Filters))\n\t\truntime.Cfg = profile\n\n\t\tif runtime.Cfg.OnSuccess != \"\" && runtime.Cfg.OnSuccess != \"continue\" && runtime.Cfg.OnSuccess != \"break\" {\n\t\t\treturn nil, fmt.Errorf(\"invalid 'on_success' for '%s': %s\", profile.Name, runtime.Cfg.OnSuccess)\n\t\t}\n\n\t\tif runtime.Cfg.OnFailure != \"\" && runtime.Cfg.OnFailure != \"continue\" && runtime.Cfg.OnFailure != \"break\" && runtime.Cfg.OnFailure != \"apply\" {\n\t\t\treturn nil, fmt.Errorf(\"invalid 'on_failure' for '%s' : %s\", profile.Name, runtime.Cfg.OnFailure)\n\t\t}\n\n\t\tfor fIdx, filter := range profile.Filters {\n\t\t\tif runtimeFilter, err = expr.Compile(filter, exprhelpers.GetExprOptions(map[string]interface{}{\"Alert\": &models.Alert{}})...); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error compiling filter of '%s': %w\", profile.Name, err)\n\t\t\t}\n\n\t\t\truntime.RuntimeFilters[fIdx] = runtimeFilter\n\t\t\tif profile.Debug != nil && *profile.Debug {\n\t\t\t\truntime.Logger.Logger.SetLevel(log.DebugLevel)\n\t\t\t}\n\t\t}\n\n\t\tif profile.DurationExpr != \"\" {","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/csprofiles/csprofiles.go#L31-L67","documentation":"NewProfile validates each profile's on_success directive; it only accepts \"continue\" or \"break\" (or empty, meaning default continue). Any other string in the profile config causes profile loading to abort.","triggerScenarios":"Calling NewProfile (via getProfilesConfigs, New, or NewProfile directly) with a profile config whose OnSuccess field is a non-empty string other than \"continue\" or \"break\", e.g. \"stop\", \"Continue\", \"apply\".","commonSituations":"Typo in profiles.yaml on_success; copying on_failure's valid value \"apply\" into on_success (apply is only valid for on_failure); case-sensitive value like \"Break\".","solutions":["Set on_success to \"continue\" or \"break\" (or remove the key to use the default).","If the intent was to apply the profile regardless, note \"apply\" is only valid for on_failure, not on_success; use \"continue\" for on_success.","Check casing: values are lowercase and case-sensitive."],"exampleFix":"// before\nname: crowdsecurity/http-bf\non_success: stop\n// after\nname: crowdsecurity/http-bf\non_success: break","handlingStrategy":"validation","validationCode":"var validOnSuccess = map[string]bool{\"\": true, \"continue\": true, \"break\": true}\nfunc onSuccessValid(v string) bool { return validOnSuccess[v] }","typeGuard":null,"tryCatchPattern":"if _, err := csprofiles.NewProfile(cfgs, ...); err != nil {\n\tif strings.Contains(err.Error(), \"invalid 'on_success'\") { /* fix the profile config value */ }\n}","preventionTips":["Only use \"continue\" or \"break\" for on_success","Remember \"apply\" is on_failure-only; do not copy it to on_success","Keep values lowercase; validation is case-sensitive"],"tags":["profiles","configuration","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}