{"record":{"id":"6202fbc43eb4675f","repo":"caddyserver/caddy","slug":"s-d-unrecognized-directive-s","errorCode":null,"errorMessage":"%s:%d: unrecognized directive: %s","messagePattern":"(.+?):(.+?): unrecognized directive: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"caddyconfig/httpcaddyfile/httptype.go","lineNumber":136,"sourceCode":"\t\t}\n\n\t\t// evaluate each directive (\"segment\") in this block\n\t\tfor _, segment := range sb.block.Segments {\n\t\t\tdir := segment.Directive()\n\n\t\t\tif strings.HasPrefix(dir, matcherPrefix) {\n\t\t\t\t// matcher definitions were pre-processed\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tdirFunc, ok := registeredDirectives[dir]\n\t\t\tif !ok {\n\t\t\t\ttkn := segment[0]\n\t\t\t\tmessage := \"%s:%d: unrecognized directive: %s\"\n\t\t\t\tif !sb.block.HasBraces {\n\t\t\t\t\tmessage += \"\\nDid you mean to define a second site? If so, you must use curly braces around each site to separate their configurations.\"\n\t\t\t\t}\n\t\t\t\treturn nil, warnings, fmt.Errorf(message, tkn.File, tkn.Line, dir)\n\t\t\t}\n\n\t\t\th := Helper{\n\t\t\t\tDispenser:    caddyfile.NewDispenser(segment),\n\t\t\t\toptions:      options,\n\t\t\t\twarnings:     &warnings,\n\t\t\t\tmatcherDefs:  matcherDefs,\n\t\t\t\tparentBlock:  sb.block,\n\t\t\t\tgroupCounter: gc,\n\t\t\t\tState:        state,\n\t\t\t\tBlockState:   state,\n\t\t\t}\n\n\t\t\tresults, err := dirFunc(h)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, warnings, fmt.Errorf(\"parsing caddyfile tokens for '%s': %v\", dir, err)\n\t\t\t}\n","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/caddyconfig/httpcaddyfile/httptype.go#L118-L154","documentation":"Error \"%s:%d: unrecognized directive: %s\" thrown in caddyserver/caddy.","triggerScenarios":"Thrown at caddyconfig/httpcaddyfile/httptype.go:136 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the directive name spelling, or remove the line if it is not a valid directive.","Check the Caddy documentation for the correct directive name and ensure the needed module is built in."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}