{"record":{"id":"cd9d95578f84ca9c","repo":"glanceapp/glance","slug":"invalid-include-match-v","errorCode":null,"errorMessage":"invalid include match: %v","messagePattern":"invalid include match: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/glance/config.go","lineNumber":274,"sourceCode":"\tmainFileAbsPath, err := filepath.Abs(mainFilePath)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"getting absolute path of %s: %w\", mainFilePath, err)\n\t}\n\tmainFileDir := filepath.Dir(mainFileAbsPath)\n\n\tif includes == nil {\n\t\tincludes = make(map[string]struct{})\n\t}\n\tvar includesLastErr error\n\n\tmainFileContents = configIncludePattern.ReplaceAllFunc(mainFileContents, func(match []byte) []byte {\n\t\tif includesLastErr != nil {\n\t\t\treturn nil\n\t\t}\n\n\t\tmatches := configIncludePattern.FindSubmatch(match)\n\t\tif len(matches) != 3 {\n\t\t\tincludesLastErr = fmt.Errorf(\"invalid include match: %v\", matches)\n\t\t\treturn nil\n\t\t}\n\n\t\tindent := string(matches[1])\n\t\tincludeFilePath := strings.TrimSpace(string(matches[2]))\n\t\tif !filepath.IsAbs(includeFilePath) {\n\t\t\tincludeFilePath = filepath.Join(mainFileDir, includeFilePath)\n\t\t}\n\n\t\tvar fileContents []byte\n\t\tvar err error\n\n\t\tincludes[includeFilePath] = struct{}{}\n\n\t\tfileContents, includes, err = recursiveParseYAMLIncludes(includeFilePath, includes, depth+1)\n\t\tif err != nil {\n\t\t\tincludesLastErr = err\n\t\t\treturn nil","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/glanceapp/glance/blob/91324e8de762702e97b0ac5c8e36271d644d8642/internal/glance/config.go#L256-L292","documentation":"An internal sanity check in the include-replacement callback: the text matched by configIncludePattern could not be re-matched to extract its subgroups (expected 3: full match, indentation, path). Because the same regexp that found the line is used for FindSubmatch, this should be unreachable unless the regexp or match payload is corrupted in memory.","triggerScenarios":"Effectively unreachable through normal input; would only occur if configIncludePattern were changed to one whose FindStringSubmatch group count differs from FindAll matches, or memory corruption of the matched bytes.","commonSituations":"Not seen by users in practice. A developer modifying the include regexp (e.g. adding/removing a capture group) without updating the len(matches) != 3 check would hit it during testing.","solutions":["If you are developing glance: keep the regexp's capture-group count in sync with the len(matches) check","As a user: report the full config to the project — this indicates a bug, not a config problem"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := loadConfig(p); err != nil {\n    if strings.Contains(err.Error(), \"invalid include match\") {\n        // internal bug: collect config and report upstream\n        reportBug(err, cfgContents)\n    }\n}","preventionTips":["Treat this error as a library bug, not a config error","Pin a known-good glance version in deployments"],"tags":["glance","internal","regexp","unreachable"],"backgroundTag":null,"analyzedSha":"91324e8de762702e97b0ac5c8e36271d644d8642","analyzedAt":"2026-08-15T14:12:54.279Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}