crowdsecurity/crowdsec · error
unknown entry type '%s' in %s (supported: %s): %s
Error message
unknown entry type '%s' in %s (supported: %s): %s
What it means
fileMapInit validates the 'type' value against validMapEntryTypes and rejects anything else. This error is thrown when the JSON line's 'type' is non-empty but not one of the supported entry types, so the map entry cannot be routed to the right lookup structure.
Source
Thrown at pkg/exprhelpers/filemap.go:64
if err := json.Unmarshal([]byte(line), &record); err != nil {
return fmt.Errorf("failed to parse JSON line in %s: %w", filename, err)
}
if record["pattern"] == "" {
return fmt.Errorf("missing mandatory 'pattern' field in %s: %s", filename, line)
}
if record["tag"] == "" {
return fmt.Errorf("missing mandatory 'tag' field in %s: %s", filename, line)
}
entryType := record["type"]
if entryType == "" {
return fmt.Errorf("missing mandatory 'type' field in %s: %s", filename, line)
}
if !slices.Contains(validMapEntryTypes, entryType) {
return fmt.Errorf("unknown entry type '%s' in %s (supported: %s): %s",
entryType, filename, strings.Join(validMapEntryTypes, ", "), line)
}
if entryType == "regex" {
if _, err := regexp.Compile(record["pattern"]); err != nil {
log.Warningf("invalid regex pattern in %s: %s", filename, err)
}
}
if dataFileMap[filename] == nil {
dataFileMap[filename] = &fileMapEntry{filename: filename}
}
dataFileMap[filename].rows = append(dataFileMap[filename].rows, record)
return nil
}
View on GitHub (pinned to 909b515798)
Solutions
- Change the line's "type" to one of the supported values listed in the error message (strings.Join(validMapEntryTypes, ", ")).
- Fix casing/typos: the comparison is exact and case-sensitive (e.g. "ip", not "IP" or "Ip").
- If the entry semantically means an address block, use "range" rather than invented types like "cidr" or "subnet".
- Refresh the data file from its official hub source if it follows a foreign schema.
Example fix
// before
{"pattern":"10.0.0.0/8","tag":"private","type":"cidr"}
// after
{"pattern":"10.0.0.0/8","tag":"private","type":"range"} Defensive patterns
Strategy: validation
Validate before calling
validTypes := []string{"ip", "range", "string", "regex", "url"} // see validMapEntryTypes
if !slices.Contains(validTypes, entryType) {
return fmt.Errorf("type %q unsupported", entryType)
} Prevention
- Copy type names exactly from the error message's supported list — they are case-sensitive
- Avoid inventing aliases like "cidr"; map them to the supported value at generation time
- Validate types in the script that generates the data file
When it happens
Trigger: Calling FileInit (via fileMapInit) on a filemap line with e.g. "type":"IP" (wrong case) or "type":"cidr" instead of a supported value like ip/range/string/regex.
Common situations: Typos or wrong casing in hand-written data files; authors guessing type names instead of consulting the supported list; data files written for a different tool or an older crowdsec version with different type names.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- bot entry '%s' in %s has no identity verification (need at l
- missing mandatory 'pattern' field in %s: %s
- missing mandatory 'tag' field in %s: %s
- missing mandatory 'type' field in %s: %s
- unknown data type '%s' for : '%s'
AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06).
Data as JSON: /api/errors/74484f4069213286.
Report an issue: GitHub.