nektos/act · error
Closing bracket without opening one. The following format st
Error message
Closing bracket without opening one. The following format string is invalid: '%s'
What it means
Thrown by format() when a '}' is encountered with no preceding unescaped '{' (state bracketClose at end of input). A lone closing brace cannot be part of a placeholder and was not escaped.
Source
Thrown at pkg/exprparser/functions.go:133
switch character {
case '}':
output += "}"
replacementIndex = ""
state = passThrough
default:
panic("Invalid format parser state")
}
}
}
if state != passThrough {
switch state {
case bracketOpen:
return "", fmt.Errorf("Unclosed brackets. The following format string is invalid: '%s'", input)
case bracketClose:
return "", fmt.Errorf("Closing bracket without opening one. The following format string is invalid: '%s'", input)
}
}
return output, nil
}
func (impl *interperterImpl) join(array reflect.Value, sep reflect.Value) (string, error) {
separator := impl.coerceToString(sep).String()
switch array.Kind() {
case reflect.Slice:
var items []string
for i := 0; i < array.Len(); i++ {
items = append(items, impl.coerceToString(array.Index(i).Elem()).String())
}
return strings.Join(items, separator), nil
default:
return strings.Join([]string{impl.coerceToString(array).String()}, separator), nilView on GitHub (pinned to 4f41128141)
Solutions
- Escape the literal closing brace as '}}'.
- Balance every placeholder's { and }.
- Move regex/code text out of the format string into the arguments.
Example fix
# before
${{ format('json = {0}}', j) }}
# after
${{ format('json = {0}', j) }} Defensive patterns
Strategy: validation
Validate before calling
// same balancedBraces check as for unclosed brackets: a negative depth
// detects a closing brace with no opener
func noStrayCloseBrace(tpl string) bool { return balancedBraces(tpl) } Prevention
- Escape literal } as }}
- Keep placeholder braces paired on one line
- Test templates in a scratch workflow before production
When it happens
Trigger: format('Hello 0}') or format('}') — closing brace without opening; escaping opening brace but not closing one ('{{' followed by single '}').
Common situations: Asymmetric brace escaping in templates; writing regular expressions or code snippets inside format() arguments.
Related errors
- Unclosed brackets. The following format string is invalid: '
- The following format string is invalid: '%s'
- The following format string references more arguments than w
- Cannot convert value to JSON. Cause: %v
- Cannot parse non-string type %v as JSON
AI-assisted analysis of nektos/act@4f41128141 (2026-08-15).
Data as JSON: /api/errors/8ca7f0831c53039c.
Report an issue: GitHub.