{"record":{"id":"03c15c4ad535f963","repo":"SigNoz/signoz","slug":"invalid-input-03c15c","errorCode":"invalid_input","errorMessage":"unsupported ctimefmt directive: %s","messagePattern":"unsupported ctimefmt directive: (.+?)","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/types/pipelinetypes/time_parser.go","lineNumber":109,"sourceCode":"\t\"%%\": \"%\",\n\t//\t%c - Date and time representation (Mon Jan 02 15:04:05 2006)\n\t\"%c\": \"[a-zA-Z]{3} [a-zA-Z]{3} [0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} [0-9]{4}\",\n}\n\nfunc RegexForStrptimeLayout(layout string) (string, error) {\n\tlayoutRegex := layout\n\tfor _, regexSpecialChar := range []string{\n\t\t\".\", \"+\", \"*\", \"?\", \"^\", \"$\", \"(\", \")\", \"[\", \"]\", \"{\", \"}\", \"|\", `\\`,\n\t} {\n\t\tlayoutRegex = strings.ReplaceAll(layoutRegex, regexSpecialChar, `\\`+regexSpecialChar)\n\t}\n\n\tvar errs []error\n\treplaceStrptimeDirectiveWithRegex := func(directive string) string {\n\t\tif regex, ok := ctimeRegex[directive]; ok {\n\t\t\treturn regex\n\t\t}\n\t\terrs = append(errs, errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, \"unsupported ctimefmt directive: \"+directive))\n\t\treturn \"\"\n\t}\n\n\tstrptimeDirectiveRegexp := regexp.MustCompile(`%.`)\n\tlayoutRegex = strptimeDirectiveRegexp.ReplaceAllStringFunc(layoutRegex, replaceStrptimeDirectiveWithRegex)\n\tif len(errs) != 0 {\n\t\treturn \"\", errors.NewInvalidInputf(errors.CodeInvalidInput, \"couldn't generate regex for ctime format: %v\", errs)\n\t}\n\n\treturn layoutRegex, nil\n}\n","sourceCodeStart":91,"sourceCodeEnd":121,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/types/pipelinetypes/time_parser.go#L91-L121","documentation":"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.","triggerScenarios":"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'.","commonSituations":"Copying strftime formats from Python/Java logs (e.g. %f) into Stanza-style ctimefmt; assuming full strptime parity; typo'd directives.","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"],"exampleFix":"// before\n{\"type\":\"time_parser\",\"format\":\"%Y-%m-%dT%H:%M:%S.%f\"}\n// after\n{\"type\":\"time_parser\",\"format\":\"%Y-%m-%dT%H:%M:%S\"}\n","handlingStrategy":"validation","validationCode":"const supported = new Set(['%Y','%m','%d','%H','%M','%S','%y','%b','%B','%e','%j','%p','%I','%Z','%z','%s']);\n[...fmt.matchAll(/%./g)].forEach(m => { if (!supported.has(m[0])) throw new Error('unsupported ' + m[0]); });","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check ctimeRegex map for the allowed directive set","Prefer strptime format when available","Unit test layouts standalone"],"tags":["pipeline","time-parser","strftime","validation","go"],"backgroundTag":"unsupported-format-directive","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}