{"record":{"id":"f283b3621df3bc6d","repo":"SigNoz/signoz","slug":"couldn-t-generate-nil-check-for-parsefrom-of-regex","errorCode":null,"errorMessage":"couldn't generate nil check for parseFrom of regex op %s: %w","messagePattern":"couldn't generate nil check for parseFrom of regex op (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/app/logparsingpipeline/pipelineBuilder.go","lineNumber":101,"sourceCode":"\t\t// Ensure name is unique\n\t\tif _, nameExists := processors[name]; nameExists {\n\t\t\tname = fmt.Sprintf(\"%s-%d\", name, pipelineIdx)\n\t\t}\n\n\t\tprocessors[name] = processor\n\t\tnames = append(names, name)\n\t}\n\treturn processors, names, nil\n}\n\nfunc getOperators(ops []pipelinetypes.PipelineOperator) ([]pipelinetypes.PipelineOperator, error) {\n\tfilteredOp := []pipelinetypes.PipelineOperator{}\n\tfor i, operator := range ops {\n\t\tif operator.Enabled {\n\t\t\tif operator.Type == \"regex_parser\" {\n\t\t\t\tparseFromNotNilCheck, err := fieldNotNilCheck(operator.ParseFrom)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\t\t\"couldn't generate nil check for parseFrom of regex op %s: %w\", operator.Name, err,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\toperator.If = fmt.Sprintf(\n\t\t\t\t\t`%s && %s matches \"%s\"`,\n\t\t\t\t\tparseFromNotNilCheck,\n\t\t\t\t\toperator.ParseFrom,\n\t\t\t\t\tstrings.ReplaceAll(\n\t\t\t\t\t\tstrings.ReplaceAll(operator.Regex, `\\`, `\\\\`),\n\t\t\t\t\t\t`\"`, `\\\"`,\n\t\t\t\t\t),\n\t\t\t\t)\n\n\t\t\t} else if operator.Type == \"grok_parser\" {\n\t\t\t\tparseFromNotNilCheck, err := fieldNotNilCheck(operator.ParseFrom)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\t\t\"couldn't generate nil check for parseFrom of grok op %s: %w\", operator.Name, err,","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/app/logparsingpipeline/pipelineBuilder.go#L83-L119","documentation":"While building the OTTL-style pipeline processor, getOperators generates a nil-check expression for the ParseFrom field of every enabled regex_parser operator. If fieldNotNilCheck(operator.ParseFrom) fails (typically because ParseFrom is empty or malformed), the builder aborts with this wrapped error naming the operator. The message wraps the underlying cause with %w, so inspect err with errors.Unwrap for specifics.","triggerScenarios":"Enabling a regex_parser operator whose ParseFrom is empty, not a valid attribute path, or unparseable by fieldNotNilCheck, then calling PreparePipelineProcessor (via ApplyPipelines / pipeline create or update APIs).","commonSituations":"User submits a pipeline YAML/JSON where a regex_parser lacks parse_from; UI form submitted before the parse_from field was filled; copy-pasted pipeline config with a typo'd attribute name; format change between API versions.","solutions":["Inspect the wrapped error (errors.Unwrap / %w chain) to see the exact reason fieldNotNilCheck failed.","Set a valid parse_from on the regex_parser operator, e.g. attributes.body or resource.service.name.","Validate operator payloads before submission: every regex_parser/grok_parser must have a non-empty parse_from.","If importing pipelines from another source, re-check the schema version expected by your query-service."],"exampleFix":"// before\n- type: regex_parser\n  enabled: true\n  name: extract-code\n  # parse_from missing\n\n// after\n- type: regex_parser\n  enabled: true\n  name: extract-code\n  parse_from: attributes.body\n  regex: \"(?P<code>\\\\d{3})\"","handlingStrategy":"validation","validationCode":"func validateRegexOp(op pipelinetypes.PipelineOperator) error {\n\tif op.Type == \"regex_parser\" && op.Enabled {\n\t\tif strings.TrimSpace(op.ParseFrom) == \"\" {\n\t\t\treturn fmt.Errorf(\"regex_parser %s requires parse_from\", op.Name)\n\t\t}\n\t}\n\treturn nil\n}\nfor _, op := range req.Pipelines[0].Config {\n\tif err := validateRegexOp(op); err != nil { return err }\n}","typeGuard":"func isRegexOpValid(op pipelinetypes.PipelineOperator) bool {\n\treturn op.Type != \"regex_parser\" || !op.Enabled || fieldNotNilCheckCanParse(op.ParseFrom)\n}","tryCatchPattern":"ops, err := getOperators(pipeline.Config)\nif err != nil {\n\tvar target *targetErrType\n\tif strings.Contains(err.Error(), \"nil check for parseFrom of regex op\") {\n\t\t// surface field-level error to the user editing the pipeline\n\t}\n\treturn ops, err\n}","preventionTips":["Validate operator schemas (parse_from required for regex_parser/grok_parser) before submission.","Use errors.Unwrap to log root causes during pipeline debugging.","Add CI linting for pipeline YAML files."],"tags":["log-pipelines","regex-parser","ottl","validation","pipeline-builder"],"backgroundTag":"pipeline-operator-validation-failed","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}