{"record":{"id":"3e1ecb093e9ced58","repo":"caddyserver/caddy","slug":"s-d-unrecognized-global-option-s","errorCode":null,"errorMessage":"%s:%d: unrecognized global option: %s","messagePattern":"(.+?):(.+?): unrecognized global option: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"caddyconfig/httpcaddyfile/httptype.go","lineNumber":386,"sourceCode":"// evaluateGlobalOptionsBlock evaluates the global options block,\n// which is expected to be the first server block if it has zero\n// keys. It returns the updated list of server blocks with the\n// global options block removed, and updates options accordingly.\nfunc (ServerType) evaluateGlobalOptionsBlock(serverBlocks []serverBlock, options map[string]any) ([]serverBlock, error) {\n\tif len(serverBlocks) == 0 || len(serverBlocks[0].block.Keys) > 0 {\n\t\treturn serverBlocks, nil\n\t}\n\n\tfor _, segment := range serverBlocks[0].block.Segments {\n\t\topt := segment.Directive()\n\t\tvar val any\n\t\tvar err error\n\t\tdisp := caddyfile.NewDispenser(segment)\n\n\t\toptFunc, ok := registeredGlobalOptions[opt]\n\t\tif !ok {\n\t\t\ttkn := segment[0]\n\t\t\treturn nil, fmt.Errorf(\"%s:%d: unrecognized global option: %s\", tkn.File, tkn.Line, opt)\n\t\t}\n\n\t\tval, err = optFunc(disp, options[opt])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"parsing caddyfile tokens for '%s': %v\", opt, err)\n\t\t}\n\n\t\t// As a special case, fold multiple \"servers\" options together\n\t\t// in an array instead of overwriting a possible existing value\n\t\tif opt == \"servers\" {\n\t\t\texistingOpts, ok := options[opt].([]serverOptions)\n\t\t\tif !ok {\n\t\t\t\texistingOpts = []serverOptions{}\n\t\t\t}\n\t\t\tserverOpts, ok := val.(serverOptions)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected type from 'servers' global options: %T\", val)\n\t\t\t}","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/caddyconfig/httpcaddyfile/httptype.go#L368-L404","documentation":"Error \"%s:%d: unrecognized global option: %s\" thrown in caddyserver/caddy.","triggerScenarios":"Thrown at caddyconfig/httpcaddyfile/httptype.go:386 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Correct or remove the unrecognized option in the global options block.","Consult the Caddyfile global options documentation for valid option names."],"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-15T22:17:37.221Z"}