SigNoz/signoz · error
invalid_input
invalid_input
Error message
unsupported ctimefmt directive: %s
What it means
When building a regex layout for ctime-based parsing, any strftime/strptime directive (%X) in the layout that has no mapping in ctimeRegex is collected and reported as unsupported. Only the whitelisted directives can be converted for timestamp parsing.
Source
Thrown at pkg/types/pipelinetypes/time_parser.go:109
"%%": "%",
// %c - Date and time representation (Mon Jan 02 15:04:05 2006)
"%c": "[a-zA-Z]{3} [a-zA-Z]{3} [0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} [0-9]{4}",
}
func RegexForStrptimeLayout(layout string) (string, error) {
layoutRegex := layout
for _, regexSpecialChar := range []string{
".", "+", "*", "?", "^", "$", "(", ")", "[", "]", "{", "}", "|", `\`,
} {
layoutRegex = strings.ReplaceAll(layoutRegex, regexSpecialChar, `\`+regexSpecialChar)
}
var errs []error
replaceStrptimeDirectiveWithRegex := func(directive string) string {
if regex, ok := ctimeRegex[directive]; ok {
return regex
}
errs = append(errs, errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, "unsupported ctimefmt directive: "+directive))
return ""
}
strptimeDirectiveRegexp := regexp.MustCompile(`%.`)
layoutRegex = strptimeDirectiveRegexp.ReplaceAllStringFunc(layoutRegex, replaceStrptimeDirectiveWithRegex)
if len(errs) != 0 {
return "", errors.NewInvalidInputf(errors.CodeInvalidInput, "couldn't generate regex for ctime format: %v", errs)
}
return layoutRegex, nil
}
View on GitHub (pinned to 5069bf80b0)
Solutions
- Replace unsupported directives with supported ones (e.g. %f → drop or pre-process; check ctimeRegex map for the allowed set)
- Use strptime layout parsing if the format is standard
- Test layouts against the parser in isolation before deploying
- Consult the supported directive table in time_parser.go
Example fix
// before
{"type":"time_parser","format":"%Y-%m-%dT%H:%M:%S.%f"}
// after
{"type":"time_parser","format":"%Y-%m-%dT%H:%M:%S"}
Defensive patterns
Strategy: validation
Validate before calling
const supported = new Set(['%Y','%m','%d','%H','%M','%S','%y','%b','%B','%e','%j','%p','%I','%Z','%z','%s']);
[...fmt.matchAll(/%./g)].forEach(m => { if (!supported.has(m[0])) throw new Error('unsupported ' + m[0]); }); Prevention
- Check ctimeRegex map for the allowed directive set
- Prefer strptime format when available
- Unit test layouts standalone
When it happens
Trigger: A pipeline time_parser operator whose ctimefmt layout uses a directive the library doesn't support, e.g. %f (microseconds), %Z variants, %L, or a literal stray percent like '%%x'.
Common situations: Copying strftime formats from Python/Java logs (e.g. %f) into Stanza-style ctimefmt; assuming full strptime parity; typo'd directives.
Related errors
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/03c15c4ad535f963.
Report an issue: GitHub.