glanceapp/glance · error
invalid include match: %v
Error message
invalid include match: %v
What it means
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.
Source
Thrown at internal/glance/config.go:274
mainFileAbsPath, err := filepath.Abs(mainFilePath)
if err != nil {
return nil, nil, fmt.Errorf("getting absolute path of %s: %w", mainFilePath, err)
}
mainFileDir := filepath.Dir(mainFileAbsPath)
if includes == nil {
includes = make(map[string]struct{})
}
var includesLastErr error
mainFileContents = configIncludePattern.ReplaceAllFunc(mainFileContents, func(match []byte) []byte {
if includesLastErr != nil {
return nil
}
matches := configIncludePattern.FindSubmatch(match)
if len(matches) != 3 {
includesLastErr = fmt.Errorf("invalid include match: %v", matches)
return nil
}
indent := string(matches[1])
includeFilePath := strings.TrimSpace(string(matches[2]))
if !filepath.IsAbs(includeFilePath) {
includeFilePath = filepath.Join(mainFileDir, includeFilePath)
}
var fileContents []byte
var err error
includes[includeFilePath] = struct{}{}
fileContents, includes, err = recursiveParseYAMLIncludes(includeFilePath, includes, depth+1)
if err != nil {
includesLastErr = err
return nilView on GitHub (pinned to 91324e8de7)
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
Defensive patterns
Strategy: try-catch
Try / catch
if err := loadConfig(p); err != nil {
if strings.Contains(err.Error(), "invalid include match") {
// internal bug: collect config and report upstream
reportBug(err, cfgContents)
}
} Prevention
- Treat this error as a library bug, not a config error
- Pin a known-good glance version in deployments
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- creating request for app access token: %v
- %s widget: %v
- recursion depth limit of %d reached
- reading %s: %w
- getting absolute path of %s: %w
AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15).
Data as JSON: /api/errors/cd9d95578f84ca9c.
Report an issue: GitHub.