{"record":{"id":"21f90e70b3e6d321","repo":"dagger/dagger","slug":"invalid-grep-pattern-q-w","errorCode":null,"errorMessage":"invalid grep pattern %q: %w","messagePattern":"invalid grep pattern %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/mcp.go","lineNumber":2519,"sourceCode":"// renderReadLogs shapes captured log lines into a ReadLogs result: trims the\n// last offset lines, applies the grep filter, numbers the lines, and caps the\n// output. The error and empty cases carry the numbers an agent needs to\n// recover — how many lines exist, how many were searched.\nfunc renderReadLogs(spanID string, logs []string, offset, limit int, grepPattern string) (string, error) {\n\tif offset < 0 {\n\t\toffset = 0\n\t}\n\t// Trim the last offset lines\n\tif offset >= len(logs) {\n\t\treturn \"\", fmt.Errorf(\"offset %d skips all %d available lines; retry with a smaller offset (0 reads the tail)\", offset, len(logs))\n\t}\n\tlogs = logs[:len(logs)-offset]\n\n\t// Apply grep filter if specified\n\tif grepPattern != \"\" {\n\t\tre, err := regexp.Compile(grepPattern)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"invalid grep pattern %q: %w\", grepPattern, err)\n\t\t}\n\t\tvar filteredLogs []string\n\t\tfor i, line := range logs {\n\t\t\tif re.MatchString(line) {\n\t\t\t\tfilteredLogs = append(filteredLogs, fmt.Sprintf(\"%6d→%s\", i+1, line))\n\t\t\t}\n\t\t}\n\t\tif len(filteredLogs) == 0 {\n\t\t\treturn fmt.Sprintf(\"(no matches for %q in the %d lines beneath span %s)\", grepPattern, len(logs), spanID), nil\n\t\t}\n\t\tlogs = filteredLogs\n\t} else {\n\t\tfor i, line := range logs {\n\t\t\tlogs[i] = fmt.Sprintf(\"%6d→%s\", i+1, line)\n\t\t}\n\t}\n\n\t// Apply line limit if specified","sourceCodeStart":2501,"sourceCodeEnd":2537,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/mcp.go#L2501-L2537","documentation":"renderReadLogs: compiling the requested grep pattern as a regex failed — the pattern is not valid regexp syntax.","triggerScenarios":"Thrown at core/mcp.go:2519 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the regex syntax named by the wrapped error","Escape regex metacharacters to match literally","Omit grep to read unfiltered"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}