crowdsecurity/crowdsec · error
serializing console context: %s
Error message
serializing console context: %s
What it means
At the end of LoadConsoleContext the assembled context map is JSON-marshaled as a sanity check; if marshaling fails the context data is not serializable (invalid types/keys), signaling corrupted context content.
Source
Thrown at pkg/alertcontext/config.go:136
if _, err := os.Stat(c.Crowdsec.ConsoleContextPath); err != nil {
return fmt.Errorf("while checking console_context_path: %w", err)
}
} else {
c.Crowdsec.ConsoleContextPath = filepath.Join(c.ConfigPaths.ConfigDir, "console", "context.yaml")
ignoreMissing = true
}
if err := addContextFromFile(c.Crowdsec.ContextToSend, c.Crowdsec.ConsoleContextPath); err != nil {
if !errors.Is(err, fs.ErrNotExist) {
return err
} else if !ignoreMissing {
log.Warningf("while merging context from %s: %s", c.Crowdsec.ConsoleContextPath, err)
}
}
feedback, err := json.Marshal(c.Crowdsec.ContextToSend)
if err != nil {
return fmt.Errorf("serializing console context: %s", err)
}
log.Debugf("console context to send: %s", feedback)
return nil
}
View on GitHub (pinned to 909b515798)
Solutions
- Inspect the context items and console context file for unusual data types
- Fix malformed context values (must be string lists)
- Report a bug if context content looks normal
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at pkg/alertcontext/config.go:136 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06).
Data as JSON: /api/errors/397a77ded083983b.
Report an issue: GitHub.