{"record":{"id":"0c2b8c505a8d5755","repo":"caddyserver/caddy","slug":"no-know-function-was-given","errorCode":null,"errorMessage":"no know function was given","messagePattern":"no know function was given","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"modules/caddyhttp/templates/tplcontext.go","lineNumber":501,"sourceCode":"\t\tif dataerr != nil {\n\t\t\treturn \"\", fmt.Errorf(\"humanize: size cannot be parsed: %s\", dataerr.Error())\n\t\t}\n\t\treturn humanize.Bytes(dataint), nil\n\n\tcase \"time\":\n\t\ttimelayout := time.RFC1123Z\n\t\tif len(parts) > 1 {\n\t\t\ttimelayout = parts[1]\n\t\t}\n\n\t\tdataint, dataerr := time.Parse(timelayout, data)\n\t\tif dataerr != nil {\n\t\t\treturn \"\", fmt.Errorf(\"humanize: time cannot be parsed: %s\", dataerr.Error())\n\t\t}\n\t\treturn humanize.Time(dataint), nil\n\t}\n\n\treturn \"\", fmt.Errorf(\"no know function was given\")\n}\n\n// funcMaybe invokes the plugged-in function named functionName if it is plugged in\n// (is a module in the 'http.handlers.templates.functions' namespace). If it is not\n// available, a log message is emitted.\n//\n// The first argument is the function name, and the rest of the arguments are\n// passed on to the actual function.\n//\n// This function is useful for executing templates that use components that may be\n// considered as optional in some cases (like during local development) where you do\n// not want to require everyone to have a custom Caddy build to be able to execute\n// your template.\n//\n// NOTE: This function is EXPERIMENTAL and subject to change or removal.\nfunc (c TemplateContext) funcMaybe(functionName string, args ...any) (any, error) {\n\tfor _, funcMap := range c.CustomFuncs {\n\t\tif fn, ok := funcMap[functionName]; ok {","sourceCodeStart":483,"sourceCodeEnd":519,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddyhttp/templates/tplcontext.go#L483-L519","documentation":"Returned by the templates module's humanize function when the format-type prefix matches neither 'size' nor 'time' (the switch falls through to the default). Note the message itself contains an upstream typo ('no know function') - it is about the humanize sub-function, not about missing template functions in general.","triggerScenarios":"{{ humanize \"bytes\" \"1024\" }}, {{ humanize \"date\" \"...\" }}, or an empty format string {{ humanize \"\" ... }}; anything whose part before the optional ':' is not exactly size or time.","commonSituations":"Assuming humanize supports more formats than it does (it only supports size and time), typos like 'Size' (case-sensitive switch), or placeholder-driven format strings that resolve to unexpected values.","solutions":["Use only 'size' or 'time' (optionally 'time:<layout>'): {{ humanize \"size\" \"2048\" }}","Check spelling and case - the switch is case-sensitive","If the format comes from a variable, validate it in the template before calling humanize","For other formats (ordinal, comma) compute them with math functions in the template instead"],"exampleFix":"<!-- before -->\n{{ humanize \"bytes\" \"2048\" }}\n\n<!-- after -->\n{{ humanize \"size\" \"2048\" }}","handlingStrategy":"validation","validationCode":"{{ $fmt := .Format }}{{ if or (eq $fmt \"size\") (hasPrefix $fmt \"time\") }}{{ humanize $fmt .Data }}{{ else }}unsupported humanize format{{ end }}","typeGuard":"{{ $ok := or (eq (index (split .Format \":\") 0) \"size\") (eq (index (split .Format \":\") 0) \"time\") }}","tryCatchPattern":null,"preventionTips":["Restrict humanize usage to size and time[:layout]","Validate format strings from variables before passing them on","Note the case-sensitive switch; test each format against live rendering"],"tags":["caddy","templates","humanize","validation"],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}