{"record":{"id":"660f3ba0576fd145","repo":"nektos/act","slug":"the-following-format-string-references-more-argume","errorCode":null,"errorMessage":"The following format string references more arguments than were supplied: '%s'","messagePattern":"The following format string references more arguments than were supplied: '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/exprparser/functions.go","lineNumber":103,"sourceCode":"\t\t\t}\n\n\t\tcase bracketOpen: // found {\n\t\t\tswitch character {\n\t\t\tcase '{':\n\t\t\t\toutput += \"{\"\n\t\t\t\treplacementIndex = \"\"\n\t\t\t\tstate = passThrough\n\n\t\t\tcase '}':\n\t\t\t\tindex, err := strconv.ParseInt(replacementIndex, 10, 32)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", fmt.Errorf(\"The following format string is invalid: '%s'\", input)\n\t\t\t\t}\n\n\t\t\t\treplacementIndex = \"\"\n\n\t\t\t\tif len(replaceValue) <= int(index) {\n\t\t\t\t\treturn \"\", fmt.Errorf(\"The following format string references more arguments than were supplied: '%s'\", input)\n\t\t\t\t}\n\n\t\t\t\toutput += impl.coerceToString(replaceValue[index]).String()\n\n\t\t\t\tstate = passThrough\n\n\t\t\tdefault:\n\t\t\t\treplacementIndex += string(character)\n\t\t\t}\n\n\t\tcase bracketClose: // found }\n\t\t\tswitch character {\n\t\t\tcase '}':\n\t\t\t\toutput += \"}\"\n\t\t\t\treplacementIndex = \"\"\n\t\t\t\tstate = passThrough\n\n\t\t\tdefault:","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/exprparser/functions.go#L85-L121","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"# before\n${{ format('{0} {1}', 'a') }}\n# after\n${{ format('{0} {1}', 'a', 'b') }}","handlingStrategy":"validation","validationCode":"func formatArityOK(tpl string, nargs int) bool {\n  re := regexp.MustCompile(`\\{(\\d+)\\}`)\n  for _, m := range re.FindAllStringSubmatch(tpl, -1) {\n    i, _ := strconv.Atoi(m[1])\n    if i >= nargs { return false }\n  }\n  return true\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember format() indices are 0-based","Keep placeholders and arguments adjacent in code review","Let actionlint verify format() arity statically"],"tags":["expressions","format-function","workflow-yaml","arity"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}