{"record":{"id":"823e32a455785a41","repo":"SigNoz/signoz","slug":"could-not-create-nil-check-for-s-w","errorCode":null,"errorMessage":"could not create nil check for %s: %w","messagePattern":"could not create nil check for (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/app/logparsingpipeline/pipelineBuilder.go","lineNumber":511,"sourceCode":"\t// Generating nil check for deepest fields takes care of their prefixes too.\n\t// Eg: `attributes.test.value + len(attributes.test)` needs a nil check only for `attributes.test.value`\n\tdeepestFieldRefs := []string{}\n\tfor _, field := range referencedFields {\n\t\tisPrefixOfAnotherReferencedField := slices.ContainsFunc(\n\t\t\treferencedFields, func(e string) bool {\n\t\t\t\treturn len(e) > len(field) && strings.HasPrefix(e, field)\n\t\t\t},\n\t\t)\n\t\tif !isPrefixOfAnotherReferencedField {\n\t\t\tdeepestFieldRefs = append(deepestFieldRefs, field)\n\t\t}\n\t}\n\n\tfieldExprChecks := []string{}\n\tfor _, field := range deepestFieldRefs {\n\t\tcheckExpr, err := fieldNotNilCheck(field)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"could not create nil check for %s: %w\", field, err)\n\t\t}\n\t\tfieldExprChecks = append(fieldExprChecks, fmt.Sprintf(\"(%s)\", checkExpr))\n\t}\n\n\treturn strings.Join(fieldExprChecks, \" && \"), nil\n}\n\n// Expr AST visitor for extracting referenced log fields\n// See more at https://github.com/expr-lang/expr/blob/master/ast/visitor.go\ntype logFieldsInExprExtractor struct {\n\treferencedFields []string\n}\n\nfunc (v *logFieldsInExprExtractor) Visit(node *ast.Node) {\n\tif n, ok := (*node).(*ast.MemberNode); ok {\n\t\tmemberRef := n.String()\n\n\t\t// coalesce ops end up as MemberNode right now for some reason.","sourceCodeStart":493,"sourceCodeEnd":529,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/app/logparsingpipeline/pipelineBuilder.go#L493-L529","documentation":"After successfully extracting referenced fields from an expression, the builder calls fieldNotNilCheck on each deepest field path. This error means one of those extracted paths still could not be turned into a nil-check, i.e. the expression referenced a field with an invalid root or malformed path. It is the field-level companion of the expr extraction errors.","triggerScenarios":"An expression like \"foo + attributes.bar\" or \"resource\" where a referenced identifier is not a valid log field root/path; also paths with trailing dots or empty segments inside an otherwise parseable expr.","commonSituations":"Using bare attribute names in expressions (user_id instead of attributes.user_id); referencing metadata keys that don't exist under resource.; copying expressions from other tools (Grafana/OTTL) with different root conventions.","solutions":["Prefix every referenced field with a valid root: attributes.*, resource.*, body","Remove stray/empty path segments (trailing dots, double dots)","Lint all expressions in the pipeline before applying"],"exampleFix":"// before\nvalue: \"expr:duration_ms / 1000\"\n// after\nvalue: \"expr:attributes.duration_ms / 1000\"","handlingStrategy":"validation","validationCode":"program, err := expr.Compile(s, expr.Env(map[string]interface{}{}))\nif err != nil { return err }\n// then walk referenced identifiers and validate roots\nfor _, id := range collectIdentifiers(program) {\n  if !validFieldPath(id) { return fmt.Errorf(\"invalid field %q in expr\", id) }\n}","typeGuard":"func exprFieldsAllValid(s string) bool { return isValidExpr(s) && allFieldsValid(collectIdentifiers(s)) }","tryCatchPattern":"Wrap pipeline API errors and highlight the offending field from the message ('could not create nil check for X').","preventionTips":["Prefix every identifier in expressions with attributes./resource./body","Reject bare identifiers in expression review/lint","Keep an allowed-roots list in pipeline tooling"],"tags":["signoz","log-parsingpipeline","field-validation","expr"],"backgroundTag":"invalid-field-path","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}