nektos/act · error
The following format string references more arguments than w
Error message
The following format string references more arguments than were supplied: '%s'
What it means
Thrown by format() when a placeholder index parses fine but exceeds the number of supplied arguments (len(replaceValue) <= index). E.g. format('{1} {2}', 'a') references argument 2 that was never passed.
Source
Thrown at pkg/exprparser/functions.go:103
}
case bracketOpen: // found {
switch character {
case '{':
output += "{"
replacementIndex = ""
state = passThrough
case '}':
index, err := strconv.ParseInt(replacementIndex, 10, 32)
if err != nil {
return "", fmt.Errorf("The following format string is invalid: '%s'", input)
}
replacementIndex = ""
if len(replaceValue) <= int(index) {
return "", fmt.Errorf("The following format string references more arguments than were supplied: '%s'", input)
}
output += impl.coerceToString(replaceValue[index]).String()
state = passThrough
default:
replacementIndex += string(character)
}
case bracketClose: // found }
switch character {
case '}':
output += "}"
replacementIndex = ""
state = passThrough
default:View on GitHub (pinned to 4f41128141)
Solutions
- Make every {N} have a matching argument at position N (0-based).
- Count placeholders versus arguments; add the missing arguments.
- Run actionlint on the workflow — it statically checks format() arity.
Example fix
# before
${{ format('{0} {1}', 'a') }}
# after
${{ format('{0} {1}', 'a', 'b') }} Defensive patterns
Strategy: validation
Validate before calling
func formatArityOK(tpl string, nargs int) bool {
re := regexp.MustCompile(`\{(\d+)\}`)
for _, m := range re.FindAllStringSubmatch(tpl, -1) {
i, _ := strconv.Atoi(m[1])
if i >= nargs { return false }
}
return true
} Prevention
- Remember format() indices are 0-based
- Keep placeholders and arguments adjacent in code review
- Let actionlint verify format() arity statically
When it happens
Trigger: Placeholders numbered higher than the argument count; deleting an argument but leaving its placeholder; assuming 1-based indexing when it is 0-based (format('{1}', only) with one arg).
Common situations: Refactoring expressions and dropping arguments; copy-paste from docs with more placeholders than args; off-by-one confusion because GitHub's format() is 0-based.
Related errors
- The following format string is invalid: '%s'
- Unclosed brackets. The following format string is invalid: '
- Closing bracket without opening one. The following format st
- 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/660f3ba0576fd145.
Report an issue: GitHub.