1Panel-dev/1Panel · error
no enough parameter for location
Error message
no enough parameter for location
What it means
Panic in NewLocation when converting a parsed 'location' directive whose parameter list is empty — the parser expected at least a match string (e.g. '/' or '= /exact'). It indicates a malformed nginx config block like 'location { ... }' being processed by the 1Panel nginx AST layer.
Source
Thrown at agent/utils/nginx/components/location.go:45
AllowMethods string
AllowHeaders string
AllowOrigins string
AllowCredentials bool
Preflight bool
}
func (l *Location) GetCodeBlock() string {
return ""
}
func NewLocation(directive IDirective) *Location {
location := &Location{
Modifier: "",
Match: "",
}
directives := make([]IDirective, 0)
if len(directive.GetParameters()) == 0 {
panic("no enough parameter for location")
}
for _, dir := range directive.GetBlock().GetDirectives() {
directives = append(directives, dir)
params := dir.GetParameters()
switch dir.GetName() {
case "proxy_pass":
location.ProxyPass = params[0]
case "proxy_set_header":
if params[0] == "Host" {
location.Host = params[1]
}
case "proxy_cache":
location.Cache = true
case "if":
if params[0] == "(" && params[1] == "$uri" && params[2] == "~*" {
dirs := dir.GetBlock().GetDirectives()
for _, di := range dirs {
if di.GetName() == "expires" {View on GitHub (pinned to 5ac7c80881)
Solutions
- Find the offending block: grep -rn '^\s*location\s*{' /opt/1panel/apps/openresty/openresty/conf -r and add the missing match ('location / {')
- Fix the template/variable that produced the empty location so it always emits a path
- Reload/re-parse the config through 1Panel to confirm no panic
Example fix
# before
location {
proxy_pass http://up;
}
# after
location / {
proxy_pass http://up;
} Defensive patterns
Strategy: validation
Validate before calling
grep -rnE '^\s*location\s*\{' /opt/1panel/apps/openresty/openresty/conf 2>/dev/null # must be empty before parsing via 1Panel Prevention
- Run nginx -t after every manual config edit before 1Panel re-parses the file
- Template generators should always emit a match token for location blocks
When it happens
Trigger: Parsing a server block containing a bare 'location' with no argument; the parser hands the directive to wrapLocation and NewLocation immediately panics on len(directive.GetParameters())==0.
Common situations: User hand-edited a website config and deleted the path after 'location'; a template rendered an empty match variable; a config generator bug emitted 'location {'.
Related errors
- unexpected token %s (%s) on line %d, column %d
- Fatal error config file: %s \n
- unexpected end of file while scanning a string, maybe an unc
- unexpected end of file while scanning a string, maybe an unc
- unexpected-container-path
AI-assisted analysis of 1Panel-dev/1Panel@5ac7c80881 (2026-08-15).
Data as JSON: /api/errors/2b7040589ec4895c.
Report an issue: GitHub.