{"record":{"id":"536f1c6a40bc88c7","repo":"caddyserver/caddy","slug":"parsing-caddyfile-tokens-for-s-v","errorCode":null,"errorMessage":"parsing caddyfile tokens for '%s': %v","messagePattern":"parsing caddyfile tokens for '(.+?)': (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"caddyconfig/httpcaddyfile/httptype.go","lineNumber":152,"sourceCode":"\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\n\t\t\tdir = normalizeDirectiveName(dir)\n\n\t\t\tfor _, result := range results {\n\t\t\t\tresult.directive = dir\n\t\t\t\tsb.pile[result.Class] = append(sb.pile[result.Class], result)\n\t\t\t}\n\n\t\t\t// specially handle named routes that were pulled out from\n\t\t\t// the invoke directive, which could be nested anywhere within\n\t\t\t// some subroutes in this directive; we add them to the pile\n\t\t\t// for this server block\n\t\t\tif state[namedRouteKey] != nil {\n\t\t\t\tfor name := range state[namedRouteKey].(map[string]struct{}) {\n\t\t\t\t\tresult := ConfigValue{Class: namedRouteKey, Value: name}\n\t\t\t\t\tsb.pile[result.Class] = append(sb.pile[result.Class], result)\n\t\t\t\t}","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/caddyconfig/httpcaddyfile/httptype.go#L134-L170","documentation":"Error \"parsing caddyfile tokens for '%s': %v\" thrown in caddyserver/caddy.","triggerScenarios":"Thrown at caddyconfig/httpcaddyfile/httptype.go:152 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the syntax error inside the referenced directive's block; the wrapped error shows the exact token problem."],"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"}