{"record":{"id":"d5e1ca750a6fea61","repo":"crowdsecurity/crowdsec","slug":"onsuccess-q-not-continue-next-stage","errorCode":null,"errorMessage":"onsuccess %q not continue,next_stage","messagePattern":"onsuccess %q not continue,next_stage","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/parser/node.go","lineNumber":76,"sourceCode":"\t\treturn\n\t}\n\tn.LeavesNodes = make([]Node, len(subNodes))\n\tfor i := range subNodes {\n\t\tchild := Node{NodeConfig: subNodes[i]}\n\t\tchild.initRuntimeChildrenFromConfig()\n\t\tn.LeavesNodes[i] = child\n\t}\n}\n\nfunc (n *Node) validate(ectx EnricherCtx) error {\n\t// stage is being set automagically\n\tif n.Stage == \"\" {\n\t\treturn errors.New(\"stage needs to be an existing stage\")\n\t}\n\n\t/* \"\" behaves like continue */\n\tif n.OnSuccess != \"continue\" && n.OnSuccess != \"next_stage\" && n.OnSuccess != \"\" {\n\t\treturn fmt.Errorf(\"onsuccess %q not continue,next_stage\", n.OnSuccess)\n\t}\n\n\tif n.Filter != \"\" && n.RunTimeFilter == nil {\n\t\treturn fmt.Errorf(\"non-empty filter %q was not compiled\", n.Filter)\n\t}\n\n\tif n.RuntimeGrok.RunTimeRegexp != nil || n.Grok.TargetField != \"\" {\n\t\tif err := n.Grok.Validate(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tfor idx, static := range n.Statics {\n\t\tif err := static.Validate(ectx); err != nil {\n\t\t\treturn fmt.Errorf(\"static %d: %w\", idx, err)\n\t\t}\n\t}\n","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/parser/node.go#L58-L94","documentation":"Node.validate() checks that a parser node's on_success directive is one of the allowed values: \"continue\", \"next_stage\", or empty (\"\" behaves like continue). Any other string is rejected at config load time so invalid parser trees fail fast instead of misbehaving at runtime.","triggerScenarios":"validate() (called by compile and tests) reads n.OnSuccess with a value other than continue/next_stage/empty, e.g. \"filter\" or \"continue_on_failure\" in a parser YAML node.","commonSituations":"Typo in a custom parser config (onsuccess: contnue); copying on_success values from enricher/stash syntaxes that allow different keywords; writing camelCase or mixed-case values where only lowercase are accepted.","solutions":["Change on_success in the parser node YAML to exactly \"continue\" or \"next_stage\" (lowercase).","Remove the on_success key entirely to get the default (continue) behavior.","Check hub collection docs for the correct on_success semantics."],"exampleFix":"// before (parser yaml)\nonsuccess: continue_if_matched\n// after\nonsuccess: continue","handlingStrategy":"validation","validationCode":"var validOnSuccess = map[string]bool{\"\": true, \"continue\": true, \"next_stage\": true}\nif !validOnSuccess[strings.TrimSpace(node.YAMLOnSuccess)] {\n    return fmt.Errorf(\"onsuccess %q must be continue or next_stage\", node.YAMLOnSuccess)\n}","typeGuard":null,"tryCatchPattern":"if err := nodes.Load(yaml, pctx); err != nil {\n    if strings.Contains(err.Error(), \"onsuccess\") {\n        logger.Errorf(\"invalid on_success keyword in parser config; use continue or next_stage: %v\", err)\n    }\n    return err\n}","preventionTips":["Only use the exact lowercase keywords \"continue\" or \"next_stage\" for on_success.","Omit the key when the default (continue) behavior is desired.","Lint parser YAML against hub collection examples."],"tags":["parser","validation","config","crowdsec"],"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"}